有奖捉虫:行业应用 & 管理与支持文档专题 HOT

Methods(方法)

close

close(): voidn连接关闭。
Returns:void

on

on(event, callback): voidn消息事件监听。

Parameters

Name
Type
Description
event
string
事件名
callback
(...args: any[]) => void
回调函数
Returns:void

ping

ping(): voidn发送 ping 消息。
Returns:void

pong

pong(): voidn发送 pong 消息。
Returns:void

send

send(msg): voidn文本消息发送。

Parameters

Name
Type
Description
msg
string
文本内容
Returns:void

sendBinary

sendBinary(msg): voidn二进制消息发送。

Parameters

Name
Type
Description
msg
ArrayBuffer
二进制内容
Returns:void

setInterval

setInterval(callback, intervalMs): voidn设置轮询函数。

Parameters

Name
Type
Description
callback
() => void
回调函数
intervalMs
number
设置时间,单位毫秒
Returns:void

setLoop

setLoop(callback): voidn循环执行函数。

Parameters

Name
Type
Description
callback
() => void
回调函数
Returns:void

setTimeout

setTimeout(callback, intervalMs): voidn设置定时函数。

Parameters

Name
Type
Description
callback
() => void
回调函数
intervalMs
number
设置时间,单位毫秒
Returns:void