{"library":"websocket-heartbeat-miniprogram","type":"library","category":null,"description":"Websocket-heartbeat-miniprogram (v1.0.3) is a lightweight WebSocket heartbeat library designed for WeChat Mini Programs and compatible platforms (Alipay, Baidu, Uni-app, Taro). It wraps the mini-program's WebSocket API with automatic heartbeat detection and reconnection logic, ensuring stable long-lived connections in unreliable network environments. Key differentiator: it handles platform-specific quirks (e.g., Alipay's single-socket limit) and preserves custom event hooks across reconnections, unlike the native socketTask that loses listeners after reconnect. The library is ESM-only, returns a promise, and provides a task object with stable hooks (onOpen, onClose, onMessage, onError, onReconnect) as well as the raw socketTask. Release cadence appears low; last release was a while ago. The package has minimal dependencies and is focused solely on mini-program environments.","language":"javascript","status":"active","version":"1.0.3","tags":["javascript","zimv","websocket","heartbeat","miniprogram"],"last_verified":"Sun Jun 07","install":[{"cmd":"npm install websocket-heartbeat-miniprogram","imports":["import WebsocketHeartbeat from 'websocket-heartbeat-miniprogram'","import type { Task, Options } from 'websocket-heartbeat-miniprogram'","WebsocketHeartbeat({ miniprogram: wx, connectSocketParams: { url: 'ws://...' } })","task.onMessage = (data) => { /* stable */ }"]},{"cmd":"yarn add websocket-heartbeat-miniprogram","imports":[]},{"cmd":"pnpm add websocket-heartbeat-miniprogram","imports":[]}],"homepage":"https://github.com/zimv/websocket-heartbeat-miniprogram#readme","github":"https://github.com/zimv/websocket-heartbeat-miniprogram","docs":null,"changelog":null,"pypi":null,"npm":"websocket-heartbeat-miniprogram","openapi_spec":null,"status_page":null,"smithery":null,"compatibility":null}