New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

websocket-monitor

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

websocket-monitor

A library to monitor network drops

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16
Maintainers
1
Weekly downloads
 
Created
Source

WebSocket Monitor

WebSocket Monitor is a Node.js library designed for monitoring network drops while the WebSocket connection is in process.

Installation

You can install the library using npm with the following command:

npm install websocket-monitor

Usage

// Import the WebSocketMonitor class
const WebSocketMonitor = require('websocket-monitor');

// Create an instance of WebSocketMonitor with your desired configuration
const webSocketMonitor = new WebSocketMonitor();

(async () => {
  /*
    Perform your task. Close the webSocketMonitor after your task is completed.
  */

  // Closing the WebSocketMonitor
  await webSocketMonitor.close();
});

Closing the WebSocket Monitor

The instance of WebSocket Monitor can be closed with the close() method as shown below.

await webSocketMonitor.close();

Confguration Options

The following options can be passed while initialising WebSocketMonitor.

  • websocketUrl: The WebSocket URL to connect to (default: 'wss://echo.websocket.org').
  • pingInterval: The interval (in milliseconds) for sending "ping" messages (default: 10000).
  • retry: Whether to retry the WebSocket connection on failure (default: true). The process will stop of first failure if this flag is set as false.
  • retryAttempts: The number of retry attempts before giving stopping the process (-1 for unlimited retries, default: -1).
  • debug: Set to true for getting the debug logs.
const WebSocketMonitor = require('websocket-monitor');

// Initialising WebSocketMonitor with configuration options
const monitor = new WebSocketMonitor({
  websocketUrl: "wss://echo.websocket.org",
  pingInterval: 5000,
  retry: true,
  retryAttempts: 10,
  debug: true
});

Keywords

FAQs

Package last updated on 24 Jan 2024

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