timum-viw / socket.io-client

A socket.io-client implementation for ESP8266 and Arduino
228 stars 90 forks source link

Turn off event listener on esp #18

Closed junpreetham closed 6 years ago

junpreetham commented 6 years ago

How do I turn off a listener for an event that has already been initialised using .on() ?

timum-viw commented 6 years ago

Good question! That's actually not yet implemented. Should be easy though. Just find and delete the corresponding entry in the vector. If you implement it, a pjll request would be nice!

junpreetham commented 6 years ago

I'm a bit of a noob as just started coding with the arduino. Do you mind posting an example/snippet? Thanks!

timum-viw commented 6 years ago

Find the element you want to erase using el = _events.find ('event') and then delete it using _events.erase (el), in case an element was found. You can look up the std::map reference here http://www.cplusplus.com/reference/map/. Let me know if it works!

caioaletroca commented 6 years ago

I forked this repo and added the remove event functionality. I'm glad to contribute, this repo really saves me.

timum-viw commented 6 years ago

feature has been added recently.