Skip to content

GameSocket

Defined in: net/GameSocket.ts:19

The platform-neutral socket surface (GameSocket / WeChatSocket / a Node ws wrapper all fit): multicast on(event, fn) → unsubscribe, queues sends until open, moves string|ArrayBuffer frames.

new GameSocket(options): GameSocket

Defined in: net/GameSocket.ts:28

PlatformSocketOptions

GameSocket

readyState: PlatformSocketReadyState = 'closed'

Defined in: net/GameSocket.ts:26

PlatformSocket.readyState

close(code?, reason?): void

Defined in: net/GameSocket.ts:85

number

string

void

PlatformSocket.close


connect(): void

Defined in: net/GameSocket.ts:40

void

PlatformSocket.connect


on<K>(event, handler): () => void

Defined in: net/GameSocket.ts:33

K extends keyof PlatformSocketEvents

K

(…args) => void

() => void

PlatformSocket.on


send(data): void

Defined in: net/GameSocket.ts:77

string | ArrayBuffer

void

PlatformSocket.send