@xroom.app/reconnecting-socket
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Wrapper reconnects ws socket after break

Installation

Run from command line

npm i @xroom.app/reconnecting-socket

Usage example

const { getReconnectingSocket } = require('@xroom.app/reconnecting-socket')

const url = 'http://foobar.com'

const getSocket = getReconnectingSocket(url, 1000)

let clientId

getSocket().on('open', () => {
    getSocket().send('requestId')
})

getSocket().on('message', (message) => {
    clientId = message.toString()
})

Package Sidebar

Install

npm i @xroom.app/reconnecting-socket

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

3.81 kB

Total Files

5

Last publish

Collaborators

  • xroom.app