Commit 39b0063f authored by Yoann Pigné's avatar Yoann Pigné

more robust server (client can disconnect whenever)

parent 49ba7535
......@@ -21,7 +21,7 @@
var elmt = document.getElementById("debug")
var handler = new netstream.DOMGSSink(elmt);
var transport = new netstream.Receiver("ws", "172.17.22.154", "2003", "/gs/stream", handler);
var transport = new netstream.Receiver("ws", "127.0.0.1", "2003", "/gs/stream", handler);
// transport.debug = true;
})();
</script>
......
var SERVER_IP = "172.17.22.154";
var SERVER_IP = "127.0.0.1";
var http = require('http')
, fs = require('fs')
, WebSocketServer = require('ws').Server
, WebSocket = require('ws')
, sourceID="nodeServer"
, timeID=0
, net = require('net')
......@@ -67,7 +68,9 @@ wss.on('connection', function(ws) {
console.log('events_server disconnected');
});
c.on("data", function (data) {
if(ws.readyState === WebSocket.OPEN){
ws.send(data);
}
});
});
events_server.listen(function() { //'listening' listener
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment