async-ws
A websocket lib for both node & browser, with promisify & auto reconnect.
How to use
const WebSocket = ; async { // The backend will be global.WebSocket for browser, ws fro node. const ws = 'xxxx' autoReconnect: false /* false to disable auto reconnect, otherwise enabled. */ binaryType: 'arraybuffer' options: /* options for WebSocket or WS */ ; await ws; await ws; // if socket is not ready, message will be sent after connected. ws; // will also be triggered when reconnected. ws; ws;};