You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 25, 2020. It is now read-only.
I am implementing Discord.io into our Twitch channel bot to work both in Twitch IRC and our Discord server. Part of my workflow involves an initial connection to the server via an Async.js "series" control flow.
With the Twitch library I use, I have the connection event on a .once() listener, and after a successful connection I have an .on() handler for the connection event to deal with reconnections.
With Discord.io, I want to have two .once() handlers, one for the successful initial connection, and one for a potential connection error. However, I would also like to remove these listeners after a successful connection or failed connection (on success, remove disconnect listener, on failure, remove connection listener). After removal and successful connection, i would create a new disconnect handler to deal with reconnections and other web socket errors.
However, it appears that while .on() and .once() ARE supported, .off() and .removeEventListener() are not supported. They both throw an error that "client.off / client.removeEventListener are not functions".
Is there a way with the client object to remove listeners as needed?
The text was updated successfully, but these errors were encountered:
After doing what I should have done and looked at the source code, i found 'removeListener'. I forgot that Node's 'Events' module uses removeListener and not removeEventListener. Although, could the 'off' method be added as an alias to removeListener?
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I am implementing Discord.io into our Twitch channel bot to work both in Twitch IRC and our Discord server. Part of my workflow involves an initial connection to the server via an Async.js "series" control flow.
With the Twitch library I use, I have the connection event on a .once() listener, and after a successful connection I have an .on() handler for the connection event to deal with reconnections.
With Discord.io, I want to have two .once() handlers, one for the successful initial connection, and one for a potential connection error. However, I would also like to remove these listeners after a successful connection or failed connection (on success, remove disconnect listener, on failure, remove connection listener). After removal and successful connection, i would create a new disconnect handler to deal with reconnections and other web socket errors.
However, it appears that while .on() and .once() ARE supported, .off() and .removeEventListener() are not supported. They both throw an error that "client.off / client.removeEventListener are not functions".
Is there a way with the client object to remove listeners as needed?
The text was updated successfully, but these errors were encountered: