2.0.12 • Published 3 days ago
wscl v2.0.12
wscl
Simple WebSocket wrapper with some extra features:
- auto reconnect with exponential backoff strategy
- wait connection before sending messages
Lib is small. Its size limited to 592 bytes (with all deps, minified and brotlied).
How to use
yarn add wscl
import {Client, events} from 'wscl'
const wsc = new Client({
url: 'wss://echo.websocket.org',
})
wsc.on(events.Open, console.log)
wsc.on(events.Close, console.log)
wsc.on(events.Message, console.log) // will be called with data not event
wsc.on(events.Error, console.log) // will be called with error not event
// you can send message before connect
wsc.send("message")
await wsc.connect()
console.log(wsc.connected)
wsc.close("reason")
2.0.12
3 days ago
2.0.11
2 months ago
2.0.9
2 months ago
2.0.10
2 months ago
2.0.3
2 months ago
2.0.2
2 months ago
2.0.5
2 months ago
2.0.4
2 months ago
2.0.7
2 months ago
2.0.6
2 months ago
2.0.8
2 months ago
2.0.1
2 months ago
2.0.0
2 months ago
1.1.1
1 year ago
1.2.2
1 year ago
1.2.1
1 year ago
1.1.2
1 year ago
1.1.0
3 years ago
1.0.3
3 years ago
1.0.2
5 years ago
1.0.1
5 years ago
1.0.0
5 years ago