ws-transform
Transform websocket data
Install
npm install --save ws-transform
Usage
This module wraps around an existing websocket, allowing you to modify outgoing (egress) and incoming (ingress) data. Hooking into the send method & message event, you could even add your own encryption layer.
Internally, this module awaits your function, allowing you to use asynchronous functions or return promises. Keep in mind that whatever you're wrapping may rely on same-order packages, so it may be important to quickly return the transformed data.
Node.JS
const transform = ; // Fetch a socket somehowlet remote = ; // Wrap the original websocket into something to use locallylet local = ;
Browser
This module does not directly work in the browser. You'll need to use a tool like browserify to make use it.