abhishekvp / cesium-lg

Liquid Galaxy GSoC 2016 Project: Enabling Cesium for Liquid Galaxy
5 stars 3 forks source link

server.js UDP loop - create the client message once! #22

Closed alfski closed 8 years ago

alfski commented 8 years ago

There is no reason to create the client message every iteration. It's the same message. Do it once before the loop and then just send it to each client. See code in the previous issue that was closed.

for(var i in wsClients){ //if(clients[i]!=connection) var lat = msgArray[1]; var lon = msgArray[2]; var alt = msgArray[3]; var heading = msgArray[4]_Math.PI/180; var pitch = (msgArray[5] - 90)_Math.PI/180; var roll = msgArray[6]*Math.PI/180;

            wsClients[i].send('{"msg-type":"ge-cam", "lon":'+lon+',"lat":'+lat+',"ht":'+alt+',"heading":'+heading+',"pitch":'+pitch+',"roll":'+roll+'}');

            }