Skip to content

playground / Exports / PlaygroundWebSocketClient

Class: PlaygroundWebSocketClient

WebSocket client for Playground real-time communication

Table of contents

Constructors

Methods

Constructors

constructor

new PlaygroundWebSocketClient(serverUrl, userId?, sessionId?, authToken?): PlaygroundWebSocketClient

Parameters

NameType
serverUrlstring
userId?string
sessionId?string
authToken?string

Returns

PlaygroundWebSocketClient

Defined in

playground/src/lib/playground/websocket-client.ts:78

Methods

connect

connect(): Promise<boolean>

Connect to the WebSocket server

Returns

Promise<boolean>

Defined in

playground/src/lib/playground/websocket-client.ts:88


disconnect

disconnect(): void

Disconnect from the WebSocket server

Returns

void

Defined in

playground/src/lib/playground/websocket-client.ts:179


updateAuth

updateAuth(userId, sessionId, authToken): void

Update authentication credentials

Parameters

NameType
userIdstring
sessionIdstring
authTokenstring

Returns

void

Defined in

playground/src/lib/playground/websocket-client.ts:219


sendMessage

sendMessage(message): boolean

Send a message through the WebSocket

Parameters

NameType
messageOmit<IPlaygroundWebSocketMessage, "timestamp">

Returns

boolean

Defined in

playground/src/lib/playground/websocket-client.ts:233


broadcastUpdate

broadcastUpdate(data): boolean

Broadcast playground update

Parameters

NameType
dataTUniversalValue

Returns

boolean

Defined in

playground/src/lib/playground/websocket-client.ts:256


on

on(event, handler): void

Add event listener

Parameters

NameType
eventstring
handlerTPlaygroundWebSocketEventHandler

Returns

void

Defined in

playground/src/lib/playground/websocket-client.ts:268


off

off(event, handler): void

Remove event listener

Parameters

NameType
eventstring
handlerTPlaygroundWebSocketEventHandler

Returns

void

Defined in

playground/src/lib/playground/websocket-client.ts:278


getStatus

getStatus(): IPlaygroundConnectionStatus

Get current connection status

Returns

IPlaygroundConnectionStatus

Defined in

playground/src/lib/playground/websocket-client.ts:288

Released under the MIT License.