Skip to content

MiniGameSocket

Defined in: net/MiniGameSocket.ts:18

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 MiniGameSocket(options, global): MiniGameSocket

Defined in: net/MiniGameSocket.ts:28

PlatformSocketOptions

MiniGameGlobal

MiniGameSocket

readyState: PlatformSocketReadyState = 'closed'

Defined in: net/MiniGameSocket.ts:26

PlatformSocket.readyState

close(code?, reason?): void

Defined in: net/MiniGameSocket.ts:89

number

string

void

PlatformSocket.close


connect(): void

Defined in: net/MiniGameSocket.ts:41

void

PlatformSocket.connect


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

Defined in: net/MiniGameSocket.ts:34

K extends keyof PlatformSocketEvents

K

(…args) => void

() => void

PlatformSocket.on


send(data): void

Defined in: net/MiniGameSocket.ts:81

string | ArrayBuffer

void

PlatformSocket.send