Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marchaos/resilient-websocket
A client WebSocket wrapper with support for reconnection and ping/pong with a familiar API. Written in TypeScript.
https://github.com/marchaos/resilient-websocket
ping-pong reconnect reconnecting-websocket resilient websocket
Last synced: 11 days ago
JSON representation
A client WebSocket wrapper with support for reconnection and ping/pong with a familiar API. Written in TypeScript.
- Host: GitHub
- URL: https://github.com/marchaos/resilient-websocket
- Owner: marchaos
- License: apache-2.0
- Created: 2019-03-25T23:16:16.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T17:21:22.000Z (almost 2 years ago)
- Last Synced: 2024-11-02T13:50:21.863Z (18 days ago)
- Topics: ping-pong, reconnect, reconnecting-websocket, resilient, websocket
- Language: TypeScript
- Homepage:
- Size: 224 KB
- Stars: 16
- Watchers: 2
- Forks: 5
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# resilient-websocket
A client WebSocket wrapper with support for reconnection and ping/pong with a familiar API. Written in TypeScript# Installing
```sh
npm install resilient-websocket --save
```# API
```js
import ResilientWebSocket, { WebSocketEvent } from 'resilient-websocket';const opts = {
autoJsonify: true, // parse json message from server, stringify messages on send,
pingEnabled: true // send ping / pong messages
};const rSock = new ResilientWebSocket(url, opts);
rSock.on(WebSocketEvent.CONNECTION, () => {
rSock.on(WebSocketEvent.MESSAGE, (message) => {
console.info('received message from the server', message);
rSock.send({ message: 'Right back at ya, buddy!' });
});
});
```