floatinghotpot / socket.io-unity

socket.io client for Unity, power game client with node.js back-end
494 stars 76 forks source link

Delays; Events rarely get triggered #24

Open NiklasDanz opened 6 years ago

NiklasDanz commented 6 years ago

When using the Socket.io Unity library events rarely get triggered and only a few of the messages sent from the server are recived. I'm trying to send values of a potentiometer (between 0 and 99) to my clients. When I change the value, my ESP8266 and Socket.js browser client instantly show all the change in the values. (Notice the many occurances of the values 99 and 0). On the Unity side only a few of the value changes show up (no 0 or 99).

JS console (correct output)

bildschirmfoto 2018-04-23 um 00 48 49

Unity debugger (no 0 or 99 are logged)

bildschirmfoto 2018-04-23 um 00 48 20

What do I have to change in order to reliably recive all the values in Unity as well?

My code:

`// Node Server function

socket.on('ESPValueChanged', function(value){ io.sockets.emit('valueForUnity', value) }) `

On the Unity side I'm just using the default code with socket.On('Socket.EVENT_MESSAGE'... to log all of the incoming messages. The function call is inside of the DoOpen-function.