iso-websocket
v0.3.0
Published
Isomorphic, resilient and extensible Websocket.
Downloads
298
Maintainers
Readme
iso-websocket
iso-websocket
implements the Websocket interface and is compatible with the browser, node.js and any other engine that implements basic Web APIs.
Features
- Standard API and isomorphic
- Reconnects automatically on close, connection timeout and connectivity events
- Supports connection timeout
- Extensible retry strategy with
shouldRetry
option andnode-retry
- Queue messages while offline, disconnected or reconnecting
- Supports custom url callback to reconnect to a different url
- Extensive tests
- Typed events
Install
pnpm install iso-websocket
Usage
import { WS } from 'iso-websocket'
const ws = new WS('ws://localhost:8080')
ws.addEventListener('message', (e) => {
console.log(e.data)
})
ws.send('hello')
ws.close()
Docs
Check https://hugomrdias.github.io/iso-repo/modules/iso_websocket.html
License
MIT © Hugo Dias