Miss any of our Open RFC calls?Watch the recordings here! »

@gamestdio/websocket

0.3.2 • Public • Published

@gamestdio/websocket

WebSocket with reconnect back-off feature.

For Node.js support, you should install the ws module in your project.

Usage

WebSocketClient behaves exactly in the same way as WebSocket.

It accepts an optional third parameter, which is used to configure backoff feature.

// fibonacci backoff strategy
var conn = new WebSocketClient('ws://' + host + ':8080', null, {
  backoff: "fibonacci"
});
// exponential backoff strategy
var conn = new WebSocketClient('ws://' + host + ':8080', null, {
  backoff: "exponential"
});

Event Listeners

  • onclose
  • onerror
  • onmessage
  • onopen
  • onreconnect

License

MIT

Keywords

none

Install

npm i @gamestdio/websocket

DownloadsWeekly Downloads

2,174

Version

0.3.2

License

none

Unpacked Size

116 kB

Total Files

11

Last publish

Collaborators

  • avatar