Skip to main content
Version: Next

Configuring the server

Setting the port

port: number;

Securing the connection

  • Set this if you want to secure the connection

    https?: { ... }
    • The path to the certificate file. Supports: .pem
        pathToCert: string;
    • The path to the certificate key file. Supports: .pem
        pathToKey: string;
    • The password which the certificate is encrypted with.
        passphrase?: string;

Verbose logging

verbose?: boolean;

Logger

  • You can override the server's default Logger system by giving this property an ILogger interface.
  • If you set it true, the default logging script will be used.
logger?: boolean | ILogger;

Host

  • Sets the host for the server
host?: string;

Header event

  • This event handler gets called before a new WS connection would be created.
  • If you want to add new headers to the upgrade frame's reponse, return them as an array.
headerEvent?: (recievedHeaders: IncomingHttpHeaders) => Array<string> | void;

Max waiter time

  • The maximal waiting time for waiters.
  • Defaults to 800ms
maxWaiterTime?: number;

Custom client class

clientClass?: new (
socket: WebSocketClient,
ip: string | undefined,
server: ZilaServer,
isBrowser: boolean,
headers: { [name: string]: string },
cookies?: Map<string, string>
) => ZilaClient;