Skip to content

Latest commit

 

History

History
204 lines (110 loc) · 3.43 KB

ITransport.md

File metadata and controls

204 lines (110 loc) · 3.43 KB

Interface: ITransport

Implemented by

Table of contents

Properties

Methods

Properties

client

client: ClientInstance

The client that owns this transport.

Defined in

Transports/ITransport.ts:7


onConnect

onConnect: () => void

Type declaration

▸ (): void

Should be called when connection is established.

Returns

void

Defined in

Transports/ITransport.ts:18


onDisconnect

onDisconnect: () => void

Type declaration

▸ (): void

Should be called when connection is closed.

Returns

void

Defined in

Transports/ITransport.ts:22


onError

onError: (error: string) => void

Type declaration

▸ (error): void

Should be called when an error occurs during connection.

Parameters
Name Type Description
error string The error that occurred.
Returns

void

Defined in

Transports/ITransport.ts:27


onMessage

onMessage: (message: Uint8Array) => void

Type declaration

▸ (message): void

Should be called when a message is received.

Parameters
Name Type Description
message Uint8Array The message received.
Returns

void

Defined in

Transports/ITransport.ts:32

Methods

close

close(): void

Closes the connection.

Returns

void

Defined in

Transports/ITransport.ts:42


connect

connect(serverAddr): void

Connects to a server.

Parameters

Name Type
serverAddr string

Returns

void

Defined in

Transports/ITransport.ts:47


isConnected

isConnected(): boolean

Whether the transport is connected to a server.

Returns

boolean

true if connected, false otherwise.

Defined in

Transports/ITransport.ts:13


send

send(message): void

Sends a message to the server.

Parameters

Name Type Description
message Uint8Array The message to send.

Returns

void

Defined in

Transports/ITransport.ts:38