From: Cedric Godin Date: Wed, 16 Aug 2017 17:39:47 +0000 (-0400) Subject: Removed special token in socket data parsing X-Git-Url: http://kyz.pub/gitweb/?a=commitdiff_plain;h=f11b534ef1018051060052a71ea6da703c3ee2cb;p=yn%2Fyn-odasweb.git Removed special token in socket data parsing --- diff --git a/ressources/js/tcp_link.js b/ressources/js/tcp_link.js index 1e42a1c..b312f5c 100644 --- a/ressources/js/tcp_link.js +++ b/ressources/js/tcp_link.js @@ -42,8 +42,6 @@ socket.onmessage = function(msg) { return; } - console.log(data); - if(Math.abs(data.timeStamp - currentFrame.timestamp) > 1) console.warn('Frame skipped ' + data.timeStamp.toString()); diff --git a/server.js b/server.js index c1e8aee..dff563c 100644 --- a/server.js +++ b/server.js @@ -174,15 +174,10 @@ function handleConnection(conn) { var decoder = new StringDecoder(); // Decode received string - var splitted = decoder.write(d).split('$'); - - // Split frame - splitted.forEach(function(str) { - - if(str.length > 0) { // Clear empty strings - eventEmitter.emit('newTracking',str); - } - }); + var str = decoder.write(d); + + eventEmitter.emit('newTracking',str); + } function onConnClose() { @@ -219,15 +214,10 @@ function handlePotConnection(conn) { var decoder = new StringDecoder(); // Decode received string - var splitted = decoder.write(d).split('$'); - - // Split frame - splitted.forEach(function(str) { - - if(str.length > 0) { // Clear empty strings - eventEmitter.emit('newPotential',str); - } - }); + var str = decoder.write(d); + + eventEmitter.emit('newPotential',str); + } function onConnClose() {