I'm having an issue with my sockets where my server side code is executing before my socket.emit finishes. Here's a snippet:
admin.getTh(function(th){
socket.emit('GPS', {gpsResults: data, thresholds: th, PEMSID: PEMSID, count: count});
count++;
toolbox.drawPaths(function(ta){
console.log(ta);
});
});
So what I need to have happen is the code that gets executed on the client via socket.emit('GPS', ...) to completely finish before toolbox.drawPaths happens. I tried to toss a callback on the emit like you would socket.on(..., function(){...}) but that doesn't seem to be part of the API. Any suggestions?