Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Retrieve value from socket event

I currently, have a node.js running with Socket IO. And I am listening to something like: +level and when it is retrieved from a client, update an object.

socket.on("+level", async (data) => { console.log(`Level: ${data}`);  player.updateLevel(data) })

On fortunately, this does not work. I am using Postman set it to Socket.IO and then I am sending like this: +level 10.

Screenshot:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

enter image description here

>Solution :

Set event name to +level here:

event name

And send 10 as an arg in Postman.

See the GIF here for more info:
https://blog.postman.com/postman-now-supports-socket-io/#sending-events

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading