How to use the ws._p function in ws

To help you get started, we’ve selected a few ws examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github olebedev / swarm / lib / swarm.js View on Github external
swarm.Pipe = Pipe;
swarm.ID = ID;
swarm.Spec = Spec;
swarm.Plumber = Plumber;

if (typeof(module)!=='undefined') {
    WebSocket = require('ws');
    crypto = require('crypto');
}

if (typeof(WebSocket)!=='undefined') 
    Plumber.schemes['ws'] = WebSocket;

WebSocket._p = WebSocket.prototype;
if (!WebSocket._p.on)
    WebSocket._p.on = WebSocket._p.addEventListener;
if (!WebSocket.off)
    WebSocket._p.off = WebSocket._p.removeEventListener;

/*   Pain points
 *   * base refac
 *   * basic acl/security (by hexghost)
 *   * * * * 
 *
 * */
    /*function expectedSecret (id) {
        var hash = crypto.createHash('sha1');
        hash.update(id.toString());
        hash.update(self.host.masterSecret);
        return hash.digest('base64');
    }*/
github olebedev / swarm / lib / swarm.js View on Github external
swarm.Spec = Spec;
swarm.Plumber = Plumber;

if (typeof(module)!=='undefined') {
    WebSocket = require('ws');
    crypto = require('crypto');
}

if (typeof(WebSocket)!=='undefined') 
    Plumber.schemes['ws'] = WebSocket;

WebSocket._p = WebSocket.prototype;
if (!WebSocket._p.on)
    WebSocket._p.on = WebSocket._p.addEventListener;
if (!WebSocket.off)
    WebSocket._p.off = WebSocket._p.removeEventListener;

/*   Pain points
 *   * base refac
 *   * basic acl/security (by hexghost)
 *   * * * * 
 *
 * */
    /*function expectedSecret (id) {
        var hash = crypto.createHash('sha1');
        hash.update(id.toString());
        hash.update(self.host.masterSecret);
        return hash.digest('base64');
    }*/
github olebedev / swarm / lib / swarm.js View on Github external
swarm.Peer = Peer;
swarm.Pipe = Pipe;
swarm.ID = ID;
swarm.Spec = Spec;
swarm.Plumber = Plumber;

if (typeof(module)!=='undefined') {
    WebSocket = require('ws');
    crypto = require('crypto');
}

if (typeof(WebSocket)!=='undefined') 
    Plumber.schemes['ws'] = WebSocket;

WebSocket._p = WebSocket.prototype;
if (!WebSocket._p.on)
    WebSocket._p.on = WebSocket._p.addEventListener;
if (!WebSocket.off)
    WebSocket._p.off = WebSocket._p.removeEventListener;

/*   Pain points
 *   * base refac
 *   * basic acl/security (by hexghost)
 *   * * * * 
 *
 * */
    /*function expectedSecret (id) {
        var hash = crypto.createHash('sha1');
        hash.update(id.toString());
        hash.update(self.host.masterSecret);
        return hash.digest('base64');
    }*/

ws

Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js

MIT
Latest version published 6 months ago

Package Health Score

89 / 100
Full package analysis