npm

Need private packages and team management tools?Check out npm Orgs. »

socket.io-cap

2.0.2 • Public • Published

socket.io-cap

Proxy server for capturing and modifying socket.io data.

Installation

npm install socket.io-cap

Example

const proxy = require('socket.io-cap').createProxy().listen(8889);
proxy.showAll();
const proxy = require('socket.io-cap').createProxy({/*options*/});
proxy.listen(8889);
 
proxy.on('conn', ctx => {
  proxy.showHeader(ctx);
  ctx.headers.referer = 'http://example.com';
});
 
proxy.on('packet', (p, {cSocket, pSocket}) => {
  proxy.showPacket(p, false);
 
  if (p.event == 'my-message') {
    p.args[0] = 'hello world';
  }
 
  if (p.event == 'test' && p.fromServer) {
   p.drop = true;
   cSocket.emit('custom-message', 'hello world');
  }
})

install

npm i socket.io-cap

Downloadsweekly downloads

5

version

2.0.2

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability