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

@settlemint/ws-transform-stream

Package Overview
Dependencies
Maintainers
7
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@settlemint/ws-transform-stream

Node.JS websocket Transform stream implementation

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
7
Weekly downloads
 
Created
Source

ws-transform-stream

A transformer for websocket streams.

Usage

yarn add @gertt/ws-transform-stream

or

npm install @gertt/ws-transform-stream

In your code:

const WsTransformStream = require('@gertt/ws-transform-stream');

/**
 * Make all WS messages uppercase
 */
function transform(message) {
    return message.toUpperCase();
}

const transformer = new WsTransformStream({ transform });

// You'd typically get these when receiving a request on a webserver and needing
// to forward/proxy the WS elsewhere;
const clientWsSocket = ...;
const upstreamWsSocket = ...;

// pipe the sockets through the transformer to transform any messages going from
// client to upstream server
clientWsSocket.pipe(transformer).pipe(upstreamWsSocket);

Keywords

FAQs

Package last updated on 24 Feb 2023

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