1.0.11 • Published 5 years ago

resilient-websocket v1.0.11

Weekly downloads
107
License
Apache-2.0
Repository
-
Last release
5 years ago

resilient-websocket

A client WebSocket wrapper with support for reconnection and ping/pong with a familiar API. Written in TypeScript

Installing

npm install resilient-websocket --save

API

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!' });
    });
});
1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago