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:30

PlatformSocketOptions

MiniGameGlobal

MiniGameSocket

readonly delivery: "reliable-ordered"

Defined in: net/MiniGameSocket.ts:27

wx.connectSocket and its siblings are WebSockets like any other.

PlatformSocket.delivery


readyState: PlatformSocketReadyState = 'closed'

Defined in: net/MiniGameSocket.ts:28

PlatformSocket.readyState

close(code?, reason?): void

Defined in: net/MiniGameSocket.ts:91

number

string

void

PlatformSocket.close


connect(): void

Defined in: net/MiniGameSocket.ts:43

void

PlatformSocket.connect


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

Defined in: net/MiniGameSocket.ts:36

K extends keyof PlatformSocketEvents

K

(…args) => void

() => void

PlatformSocket.on


send(data): void

Defined in: net/MiniGameSocket.ts:83

string | ArrayBuffer

void

PlatformSocket.send