A library that provides mini-program-style WebSocket APIs for HTML5+ (5+ App), web browsers, and uni-app environments (excluding mini-programs). Current stable version 1.0.7 is released irregularly. It solves ArrayBuffer type data limitation and multiple WebSocket connection issues in uni-app, and prevents white screen on some Android devices. Differentiates by offering the same API as uni-app's WebSocket but with broader platform support and bug fixes.
npm install plus-websocketNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Connects to a WebSocket server, sends a message, listens for incoming messages, and closes after 5 seconds.
For mini-programs, directly use uni.connectSocket et al.
Wrap with Promise or use uni-app style callbacks.
Use conditional compilation: // #ifdef APP-PLUS
Create a .d.ts file: declare module 'plus-websocket' { ... }Use default import: import socket from 'plus-websocket'.
Ensure code runs in a 5+ App webview, or polyfill 'plus' object in browser for testing.
Verify the WebSocket server URL and ensure it is reachable from the client.
No dependency data recorded yet.