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.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
No, I thought I would extend the ws module and make it cover both the client and server.
So we can use it like:
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.