Documentation
    Preparing search index...

    Module iso-websocket - v0.4.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.

    • 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
    pnpm install iso-websocket
    
    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()

    Check https://hugomrdias.github.io/iso-repo/modules/iso_websocket.html

    MIT © Hugo Dias

    Modules

    <internal>

    Classes

    CloseEvent
    ErrorEvent
    GenericEvent
    MessageEvent
    RetryEvent
    WS

    Interfaces

    WebSocketEventMap
    WSOptions

    Type Aliases

    ShouldRetryFn
    UrlProvider