Iskra API Reference
    Preparing search index...

    Class SocketDriver

    Implements

    Index
    maxPayloadLength: number
    name: string = 'SocketDriver'
    • get port(): number

      The port the server listens on once started (the one the OS picked for port: 0); before start, the configured port.

      Returns number

    • Publish to all sockets subscribed to the global topic.

      Parameters

      • event: string
      • payload: unknown

      Returns void

    • Publish to all sockets subscribed to a specific room.

      Parameters

      • room: string
      • event: string
      • payload: unknown

      Returns void

    • Closes the connection connectionId (as in socket:connected and a handler's ctx.socket.data); false when it is not open. For an app that authenticates in a message rather than at the handshake: a connection that never does stays open as long as its client answers pings, so close the ones that have not authenticated in time.

      Parameters

      • connectionId: string
      • code: number = 1000
      • reason: string = ''

      Returns boolean

    • Parameters

      Returns void

    • Returns void

    • Closes every open connection (1001 "going away", so clients see a clean close and can reconnect elsewhere) and the listener. A plain server.stop() only stopped accepting: connected clients kept being served after app.stop(), by handlers whose DB and other drivers were already stopped.

      Returns Promise<void>