washo4evr / Socket.io-v1.x-Library

Socket.io Library for Arduino
108 stars 58 forks source link

Missing on() method #34

Closed angel1st closed 7 years ago

angel1st commented 7 years ago

Hi there, First of all - I thanks for spending time and creating this library. I simply took a look at it, but since I have already background experience with socket.io from other projects, I was expecting to see at least two key methods:

I would appreciate if you can elaborate on the above and let me know how your lib actually implements those two key socket.io methods.

Thanks, Angel

washo4evr commented 7 years ago

Hi, Thanks for contacting me and looking into my library.

yes, the command to send data to the server is send, not emit I didnt want to mix it up with emit and broadcast

when you send data from the server, you get the data via

if (client.monitor()) // this will receive the data { Serial.println(RID); //this is the ID of the reply if (RID == "atime" && Rname == "time") { Serial.print("Il est "); Serial.println(Rcontent); } }

so, you can easily make the same .on with any switch case or if else... depending on your project and your need

let me know if that answers your questions

angel1st commented 7 years ago

I see thanks, @washo4evr it should work, I guess. Nevertheless - if you have to create Socket.io client lib, which follows typical socket.io client workflow, I would suggest to stick to the above methods. Best Regards, Angel