Skip to content

Latest commit

 

History

History
207 lines (114 loc) · 3.79 KB

ITransport.md

File metadata and controls

207 lines (114 loc) · 3.79 KB

Interface: ITransport

Implemented by

Table of contents

Properties

Methods

Properties

onConnect

onConnect: (connectionId: number) => void

Type declaration

▸ (connectionId): void

Should be called when a new connection is established.

Parameters
Name Type Description
connectionId number The ID of the connection.
Returns

void

Defined in

Transports/ITransport.ts:14


onDisconnect

onDisconnect: (connectionId: number) => void

Type declaration

▸ (connectionId): void

Should be called when a connection is closed.

Parameters
Name Type Description
connectionId number The ID of the connection.
Returns

void

Defined in

Transports/ITransport.ts:19


onMessage

onMessage: (connectionId: number, message: Uint8Array) => void

Type declaration

▸ (connectionId, message): void

Should be called when a message is received.

Parameters
Name Type Description
connectionId number The ID of the connection.
message Uint8Array The message received.
Returns

void

Defined in

Transports/ITransport.ts:25


server

server: Server

The server this transport is attached to. This is set by the server when the transport is added.

Defined in

Transports/ITransport.ts:8

Methods

close

close(connectionId): void

Closes a connection.

Parameters

Name Type Description
connectionId number The ID of the connection.

Returns

void

Defined in

Transports/ITransport.ts:37


getConnections

getConnections(): number[]

Gets the IDs of all clients connected to this transport.

Returns

number[]

Defined in

Transports/ITransport.ts:51


send

send(connectionId, message): void

Sends a message to a connection.

Parameters

Name Type Description
connectionId number The ID of the connection.
message Uint8Array The message to send.

Returns

void

Defined in

Transports/ITransport.ts:32


start

start(): void

Starts the transport.

Returns

void

Defined in

Transports/ITransport.ts:42


stop

stop(): void

Stops the transport.

Returns

void

Defined in

Transports/ITransport.ts:46