Socket
Socket
Sign inDemoInstall

proxy-websocket

Package Overview
Dependencies
5
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    proxy-websocket

An easy way to connect to websockets with HTTP/HTTPS proxies.


Version published
Weekly downloads
16
decreased by-15.79%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Proxy-Websocket

proxy-websocket provides an easy way to connect to websockets with HTTP/HTTPS proxies.

Installation

You can install proxy-websocket via npm:

npm install proxy-websocket

Example

const proxyToWs = require('proxy-websocket');

const socket = proxyToWs('wss://echo.websocket.org/', 'http://154.202.103.5:3128');

socket.on('open', () => {
    console.log('WebSocket connection opened');
});

socket.on('message', (data) => {
    const message = Buffer.from(data).toString('utf8');
    console.log('Received message:', message);
});

socket.on('close', () => {
    console.log('WebSocket connection closed');
});

Usage

The proxyToWs function takes two arguments:

  1. The URL of the WebSocket server you want to connect to.
  2. The URL of the HTTP/HTTPS proxy you want to use.
const socket = proxyToWs(websocketServerUrl, httpProxyUrl);

Keywords

FAQs

Last updated on 03 Apr 2024

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