websocket-front
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "websocket-front", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "WebSocket client for browser with reconnect and heartbeat", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.esm.js", |
@@ -48,3 +48,3 @@ # websocket-front | ||
onError: errorCallback, | ||
close: closeCallback, | ||
onClose: closeCallback, | ||
}) | ||
@@ -68,6 +68,6 @@ const receiveMessage = (message: Event) => { | ||
// 执行某些操作 | ||
// 发送消息 | ||
socket.send('发送WebSocket消息'); | ||
// 执行某些操作 | ||
// 关闭WebSocket | ||
socket.close() | ||
@@ -87,13 +87,12 @@ | ||
| 名称 | 类型 | 描述 | 默认值 | | ||
| --------------------- | ------- | -------------------------------- | -------- | | ||
| isReconnect | boolean | 是否需要自动重连 | true | | ||
| reconnectTimeout | number | 自动重连间隔时间 | 300ms | | ||
| reconnectRepeat | number | 尝试自动重连的次数 | Infinity | | ||
| isHeartbeat | boolean | 是否支持心跳检测 | 是 | | ||
| pingMsg | string | 心跳检测发送给后端的消息 | 'ping' | | ||
| pingTimeout | number | 发送心跳检测消息的延迟时间 | 30s | | ||
| pongTimeout | number | 多长时间没有收到返回的心跳就重启 | 300ms | | ||
| autoCloseBeforeUnload | | ||
| protocols | | ||
| 名称 | 类型 | 描述 | 默认值 | | ||
| ---------------- | -------- | -------------------------------- | -------- | | ||
| isReconnect | boolean | 是否需要自动重连 | true | | ||
| reconnectTimeout | number | 自动重连间隔时间 | 300ms | | ||
| reconnectRepeat | number | 尝试自动重连的次数 | Infinity | | ||
| isHeartbeat | boolean | 是否支持心跳检测 | 是 | | ||
| pingMsg | string | 心跳检测发送给后端的消息 | 'ping' | | ||
| pingTimeout | number | 发送心跳检测消息的延迟时间 | 30s | | ||
| pongTimeout | number | 多长时间没有收到返回的心跳就重启 | 300ms | | ||
| protocols | string[] | 指定子协议 | [] | | ||
@@ -100,0 +99,0 @@ ### 事件 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25256
135