Interface AdminServerOptions<Plugins>

interface AdminServerOptions<Plugins> {
    corsOptions?: CorsOptions & {
        allowPrivateNetworkAccess?: boolean;
        strict?: boolean;
    };
    debug?: boolean;
    pluginDefaults?: Partial<PluginStartParamsMap<Plugins>>;
    ruleParameters?: {
        [key: string]: any;
    };
    webSocketKeepAlive?: number;
}

Type Parameters

  • Plugins extends {
        [key: string]: AdminPlugin<any, any>;
    }

Properties

corsOptions?: CorsOptions & {
    allowPrivateNetworkAccess?: boolean;
    strict?: boolean;
}

Set CORS options to limit the sites which can send requests to manage this admin server.

debug?: boolean

Should the admin server print extra debug information? This enables admin server debugging only - individual mock session debugging must be enabled separately.

pluginDefaults?: Partial<PluginStartParamsMap<Plugins>>

Override the default parameters for sessions started from this admin server. These values will be used for each setting that is not explicitly specified by the client when creating a mock session.

ruleParameters?: {
    [key: string]: any;
}

Some rule options can't easily be specified in remote clients, since they need to access server-side state or Node APIs directly. To handle this, referenceable parameters can be provided here, and referenced with a { [MOCKTTP_PARAM_REF]: <value> } value in place of the real parameter in the remote client.

webSocketKeepAlive?: number

Set a keep alive frequency in milliseconds for the subscription & stream websockets of each session, to ensure they remain connected in long-lived connections, especially in browsers which often close quiet background connections automatically.