Interface EventSubscriber

Hierarchy

Methods

Methods

  • Removes the specified listener function from the list of functions to call when the given event is observed.

    Type Parameters

    • E extends "end" | "close" | "unknown" | "connect" | "disconnect" | "accept" | "accept:error" | "bind" | "bind:error" | "connect:delay" | "connect:retry" | "close:error" | "handshake" | "handshake:error:protocol" | "handshake:error:auth" | "handshake:error:other"

    Parameters

    • type: E

      The type of event that the listener was listening for.

    • listener: ((data: EventOfType<E>) => void)

      The previously registered listener function.

    Returns EventSubscriber

  • Adds a listener function which will be invoked when the given event type is observed. Calling this method will convert the Observer to event emitter mode, which will make it impossible to call receive() at the same time.

    socket.events.on("bind", event => {
    console.log(`Socket bound to ${event.address}`)
    // ...
    })

    Type Parameters

    • E extends "end" | "close" | "unknown" | "connect" | "disconnect" | "accept" | "accept:error" | "bind" | "bind:error" | "connect:delay" | "connect:retry" | "close:error" | "handshake" | "handshake:error:protocol" | "handshake:error:auth" | "handshake:error:other"

    Parameters

    • type: E

      The type of event to listen for.

    • listener: ((data: EventOfType<E>) => void)

      The listener function that will be called with all event data when the event is observed.

    Returns EventSubscriber

Generated using TypeDoc