You are reading a single comment by @sameh.hady and its replies. Click here to read the full conversation.
  • No, I thought I would extend the ws module and make it cover both the client and server.

    So we can use it like:

    /// Client
    var WebSocket = require("ws");
     var ws = new WebSocket("HOST",{
          port: 8080,
          protocolVersion: 13,
          origin: 'Espruino',
          keepAlive: 60  // Ping Interval in seconds.
        });enter code here
    
    /// Server
    var WebSocketServer = require("ws").Server;
     var wss = new WebSocketServer({port: 8080});
     wss.on('connection', function(ws) {
      ws.on('message', function(message) {
        bla bla
      });
    

    And thats why I wanted a way to only require the sha1 function if I am creating a server but for the client I really don't need it.

About

Avatar for sameh.hady @sameh.hady started