Class DataStreamConnection

DataStream connection which holds any necessary state information, encryption and decryption keys, manages protocol handlers and also handles sending and receiving of data stream frames.

Hierarchy

  • EventEmitter
    • DataStreamConnection

Constructors

Properties

remoteAddress: string

Methods

  • Registers a new protocol handler to handle incoming messages. The same protocol cannot be registered multiple times.

    Parameters

    • protocol: string

      name of the protocol to register the handler for

    • protocolHandler: DataStreamProtocolHandler

      object to be registered as protocol handler

    Returns boolean

  • Removes a protocol handler if it is registered.

    Parameters

    • protocol: string

      name of the protocol to unregister the handler for

    • protocolHandler: DataStreamProtocolHandler

      object which will be unregistered

    Returns void

  • Sends a new event message to the connected client.

    Parameters

    • protocol: string

      name of the protocol

    • event: string

      name of the event (also referred to as topic. See Topics for some known ones)

    • message: Record<any, any> = {}

      message dictionary which gets sent along the event

    Returns void

  • Sends a new request message to the connected client.

    Parameters

    • protocol: string

      name of the protocol

    • request: string

      name of the request (also referred to as topic. See Topics for some known ones)

    • message: Record<any, any> = {}

      message dictionary which gets sent along the request

    • callback: ResponseHandler

      handler which gets supplied with an error object if the response didn't arrive in time or the status and the message dictionary from the response

    Returns void

  • Send a new response message to a received request message to the client.

    Parameters

    • protocol: string

      name of the protocol

    • response: string

      name of the response (also referred to as topic. See Topics for some known ones)

    • id: number

      id from the request, to associate the response to the request

    • status: HDSStatus = HDSStatus.SUCCESS

      status indication if the request was successful. A status of zero indicates success.

    • message: Record<any, any> = {}

      message dictionary which gets sent along the response

    Returns void