A WebSocket library for WeChat Mini Programs. Current stable version is 1.1.10, released with support for single and multiple WebSocket connections based on the base library version. It wraps the native wx.connectSocket API and provides a Promise-based interface with automatic reconnection and event handling. It simplifies WebSocket communication in WeChat Mini Programs, which have unique constraints compared to browser environments.
npm install wxapp-websocketNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates importing the module, creating a single WebSocket connection, and using event handlers. Also shows multi-connection mode with the Multi constructor.
Use Multi constructor for multiple connections regardless of base library version.
Ensure you are using event handlers like onopen, onmessage, onerror, onclose as shown in examples.
Pass a string URL to the constructor in single mode; use Multi constructor for object parameters.
Do not use this library outside of WeChat Mini Program development.
Use default import: import Websocket from 'wxapp-websocket'.
Ensure constructor is called with correct arguments (string URL for single mode) and that the module is properly imported.
Only use this library within WeChat Mini Program development.
No dependency data recorded yet.