Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rews

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rews

Reconnectable WebSocket

  • 0.1.3
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

rews · npm npm

Reconnectable WebSocket

$ npm install rews

Example

import ReWS from 'rews';

const client = new ReWS('ws://example.com/wss');

// Native events
//   open, close, error, message     API same as native WS     https://developer.mozilla.org/en-US/docs/Web/API/WebSocket

// For example
client.on('open', event => {
  console.log('Connection opened.');
  
  client.send('Message to send');
});
client.on('message', event => console.log('New message received:', event.data));

// Custom events
//   closed, offline, online

client.on('closed', () => console.log('Connection closed and will not be opened again.'));
client.on('offline', () => console.log('You have no internet connection'));
client.on('online', () => console.log('You are back online. Reconnecting..'));

Keywords

FAQs

Package last updated on 08 Jan 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc