@tauri-apps/plugin-websocket
类
默认
构造函数
new default()
new default(id, listeners): default
参数
参数 | 类型 |
---|---|
id | 数字 |
监听器 | (arg ) => void [] |
返回值
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/websocket/guest-js/index.ts#L37
属性
属性 | 类型 | 定义于 |
---|---|---|
id | 数字 | 来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/websocket/guest-js/index.ts#L34 |
方法
addListener()
addListener(cb): void
参数
参数 | 类型 |
---|---|
cb | (arg ) => void |
返回值
void
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/websocket/guest-js/index.ts#L66
disconnect()
disconnect(): Promise<void>
返回值
Promise
<void
>
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/websocket/guest-js/index.ts#L89
send()
send(message): Promise<void>
参数
参数 | 类型 |
---|---|
message | string | number [] | Message |
返回值
Promise
<void
>
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/websocket/guest-js/index.ts#L70
connect()
static connect(url, config?): Promise<default>
参数
参数 | 类型 |
---|---|
url | 字符串 |
config ? | ConnectionConfig |
返回值
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/websocket/guest-js/index.ts#L42
接口
CloseFrame
属性
ConnectionConfig
属性
属性 | 类型 | 定义于 |
---|---|---|
acceptUnmaskedFrames? | 布尔值 | 来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/websocket/guest-js/index.ts#L12 |
headers? | HeadersInit | 来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/websocket/guest-js/index.ts#L13 |
maxFrameSize? | 数字 | 来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/websocket/guest-js/index.ts#L11 |
maxMessageSize? | 数字 | 来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/websocket/guest-js/index.ts#L10 |
maxWriteBufferSize? | 数字 | 来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/websocket/guest-js/index.ts#L9 |
writeBufferSize? | 数字 | 来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/websocket/guest-js/index.ts#L8 |
MessageKind
类型参数
类型参数 |
---|
T |
D |
属性
类型别名
消息
type Message: | MessageKind<"Text", string> | MessageKind<"Binary", number[]> | MessageKind<"Ping", number[]> | MessageKind<"Pong", number[]>| MessageKind<"Close", CloseFrame | null>;
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/websocket/guest-js/index.ts#L26
© 2025 Tauri 贡献者. CC-BY / MIT