Events: {
    accept: [];
    close: [];
    closing: [];
    connect: [];
    connecting: [];
    join: [username: string];
    leave: [username: string];
    link: [username: string];
    linking: [];
    message: [message: Message];
    reject: [reason: string];
    unlink: [username: string];
    unlinking: [];
}

The events that the client can emit.

Type declaration

  • accept: []

    This event is emitted when the client has been accepted to link to a user.

  • close: []

    This event is emitted once the connection to the server has closed.

  • closing: []

    This event is emitted once the connection to the server is closing.

  • connect: []

    This event is emitted once the client has connected to the server.

  • connecting: []

    This event is emitted once the client starts connecting to the server.

  • join: [username: string]

    This event is emitted every time a user has joined.

    Param: username

    The username of the user that joined.

  • leave: [username: string]

    This event is emitted every time a user has left.

    Note: A client will never receive a leave event for itself as it has already unlinked by the time the leave event is emitted.

    Param: username

    The username of the user that left.

  • link: [username: string]

    This event is emitted every time a connection has linked to a user.

    Param: username

    The username of the user that was linked to a connection.

  • linking: []

    This event is emitted once the client starts linking to a user.

  • message: [message: Message]

    This event is emitted every time the server sends a message to the client.

    Param: message

    The content of the message that the server sent.

  • reject: [reason: string]

    This event is emitted when the client has been rejected to link to a user.

  • unlink: [username: string]

    This event is emitted every time a connection has unlinked from its user.

    Param: username

    The username of the user that was unlinked from its connection.

  • unlinking: []

    This event is emitted once the client starts unlinking from its user.