Module iso-websocket - v0.2.0

iso-websocket NPM Version License 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 and node-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

Index

Modules

Classes

Interfaces

Type Aliases

Generated using TypeDoc