Native nodejs sharing using WebSocket Code



Service (NodeJS):


 Var WebsocketServer = Require ('WS'). Server, WSS = New WebSocketServer ({Port: 8080}); WSS.ON ('Connection', Function (WS) {Console.log ('Client Connected'); Ws.on ('Message', Function (Message) {Console.log (Message);});};   Client: 


VAR WS = New WebSocket (“WS: // LocalHost: 8080); ws.onopen = function (e) {console.log (‘connection to server opened”); SendMessage ();} function sendMessage () {ws.send (‘Hello’);}

                        
© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment