TemplatedApp is either an SSL or non-SSL app. See App for more info, read user manual.

interface TemplatedApp {
    addServerName(hostname, options): TemplatedApp;
    any(pattern, handler): TemplatedApp;
    close(): TemplatedApp;
    connect(pattern, handler): TemplatedApp;
    del(pattern, handler): TemplatedApp;
    domain(domain): TemplatedApp;
    filter(cb): TemplatedApp;
    get(pattern, handler): TemplatedApp;
    head(pattern, handler): TemplatedApp;
    listen(host, port, cb): TemplatedApp;
    listen(port, cb): TemplatedApp;
    listen(port, options, cb): TemplatedApp;
    listen_unix(cb, path): TemplatedApp;
    missingServerName(cb): TemplatedApp;
    numSubscribers(topic): number;
    options(pattern, handler): TemplatedApp;
    patch(pattern, handler): TemplatedApp;
    post(pattern, handler): TemplatedApp;
    publish(topic, message, isBinary?, compress?): boolean;
    put(pattern, handler): TemplatedApp;
    removeServerName(hostname): TemplatedApp;
    trace(pattern, handler): TemplatedApp;
    ws<UserData>(pattern, behavior): TemplatedApp;
}

Methods

  • Browse to SNI domain. Used together with .get, .post and similar to attach routes under SNI domains.

    Parameters

    • domain: string

    Returns TemplatedApp

  • Attaches a "filter" function to track socket connections / disconnections

    Parameters

    • cb: ((res, count) => void | Promise<void>)
        • (res, count): void | Promise<void>
        • Parameters

          Returns void | Promise<void>

    Returns TemplatedApp

  • Listens to hostname & port. Callback hands either false or a listen socket.

    Parameters

    • host: RecognizedString
    • port: number
    • cb: ((listenSocket) => void | Promise<void>)
        • (listenSocket): void | Promise<void>
        • Parameters

          Returns void | Promise<void>

    Returns TemplatedApp

  • Listens to port. Callback hands either false or a listen socket.

    Parameters

    • port: number
    • cb: ((listenSocket) => void | Promise<void>)
        • (listenSocket): void | Promise<void>
        • Parameters

          Returns void | Promise<void>

    Returns TemplatedApp

  • Listens to port and sets Listen Options. Callback hands either false or a listen socket.

    Parameters

    • port: number
    • options: ListenOptions
    • cb: ((listenSocket) => void | Promise<void>)
        • (listenSocket): void | Promise<void>
        • Parameters

          Returns void | Promise<void>

    Returns TemplatedApp

  • Registers a synchronous callback on missing server names. See /examples/ServerName.js.

    Parameters

    • cb: ((hostname) => void)
        • (hostname): void
        • Parameters

          • hostname: string

          Returns void

    Returns TemplatedApp

  • Publishes a message under topic, for all WebSockets under this app. See WebSocket.publish.

    Parameters

    Returns boolean

Generated using TypeDoc