Chartjs-What is the correct way to send 2 parameters in socket.io using lambdas? (I get undefined when printing in client and server)

0👍

You send {temperature, x}, which is a shorthand for {temperature: temperature, x: x}.

However, on the other side you’re expecting an object containing keys value and lugar. These are clearly not defined, therefore it logs undefined.

Also, on your client side, your listeners expect 2 parameters (function(value, lugar)) instead of one object (function({value, lugar})), so you need to refactor these as well.

If it works with one value, my guess is that you didn’t have this value encapsulated in an object, hence having a direct association between the passed value and the parameter name.

Leave a comment