Websocket

node v10.24.1
version: 1.0.0
endpointsharetweet
const ws = require("ws"); // const { wsconfig } = require("./ws_config"); // const { connection } = require("./connection"); const wsServer = new ws.Server({ port: 8080 // perMessageDeflate: wsconfig.perMessageDeflate }); wsServer.on("connection", function(c){ c.send("hi") }); global.fearless = { wss: wsServer, broadcast: function(msg) { wsServer.clients.forEach(client => { client.send(msg); }); }, count: function() { return wsServer.clients.size; } };
Loading…

no comments

    sign in to comment