Socket
Socket
Sign inDemoInstall

resilient-websocket

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    resilient-websocket

A client WebSocket wrapper with support for reconnection and ping/pong


Version published
Weekly downloads
834
decreased by-12.76%
Maintainers
1
Install size
29.6 kB
Created
Weekly downloads
 

Readme

Source

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

FAQs

Last updated on 07 Jul 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc