• client: ClientInstance
The client that owns this transport.
• onConnect: () => void
▸ (): void
Should be called when connection is established.
void
• onDisconnect: () => void
▸ (): void
Should be called when connection is closed.
void
• onError: (error
: string
) => void
▸ (error
): void
Should be called when an error occurs during connection.
Name | Type | Description |
---|---|---|
error |
string |
The error that occurred. |
void
• onMessage: (message
: Uint8Array
) => void
▸ (message
): void
Should be called when a message is received.
Name | Type | Description |
---|---|---|
message |
Uint8Array |
The message received. |
void
▸ close(): void
Closes the connection.
void
▸ connect(serverAddr
): void
Connects to a server.
Name | Type |
---|---|
serverAddr |
string |
void
▸ isConnected(): boolean
Whether the transport is connected to a server.
boolean
true if connected, false otherwise.
▸ send(message
): void
Sends a message to the server.
Name | Type | Description |
---|---|---|
message |
Uint8Array |
The message to send. |
void