[]
        
(Showing Draft Content)

Connection

Class: Connection

Represents a collaboration connection on the server.

Table of contents

Constructors

Accessors

Methods

Constructors

constructor

new Connection()

Accessors

auth

get auth(): Object

Retrieves the authentication data of the connection.

Returns

Object

The authentication data associated with the connection.


id

get id(): string

Retrieves the unique identifier of the connection.

Returns

string

The connection's ID.


query

get query(): Record<string, unknown>

Retrieves the query parameters of the connection.

Returns

Record<string, unknown>

The query parameters of the connection.


roomId

get roomId(): string

Retrieves the room identifier of the connection.

Returns

string

The room ID associated with the connection.


tags

get tags(): Map<string, unknown>

Retrieves the custom data saved for the connection.

Returns

Map<string, unknown>

A map of custom tags for the connection.

Methods

broadcast

broadcast(data, type?, includeSelf?): void

Broadcasts a message to all connections in the room.

Parameters

Name Type Description
data unknown The message data to broadcast.
type? MessageType -
includeSelf? boolean -

Returns

void


close

close(): void

Closes the connection.

Returns

void


send

send(data, type?): void

Sends a message to the client.

Parameters

Name Type Description
data unknown The message data to send.
type? MessageType -

Returns

void