New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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
Version published
Maintainers
7
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

ws

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