Closed humanchimp closed 10 years ago
open
— the connection has opened.close
— the connection has closed.fail
— the connection failed because of an error.info
, notice
, debug
— each corresponding roughly to a log levelreopen
— which could be inferred, but as a convenience event, since the kite.js is in the business of handling reconnection logic.message
— this can be nice for debugging, especially for transports other than WebSocket, which have no meaningful UI in dev tools.warn
, critical
— these correspond to log levels that are there for compatibility with the go library, but which are currently unused by kite.jsconnected
, disconnected
— for being misleadingly named.ready
— get rid of the event, but keep the method Kite#ready([cb])
.closing via 2717fd58a99e1fe21278eee71d4e3faea20e655f
Right now we're emitting rather a lot of events. I'd like to pair this down, and perhaps change the names of the events. For now we emit both
connected
andready
when the underlying connection is open. I think we should get rid of both of these, and replace them with a singleopen
event. We have a similar "problem" with thedisconnected
event. We should rename itclose
. Theerror
event is perhaps ok, except for the fact that the node EventEmitter implementation special cases this event. The user has to explicitly listen for it, or it will get converted into an "unknown, uncaught error event" or something equally useless. For this reason, it might be better to a) add a default handler for this event that does not mask the original error, or b) call the event something else, likefail
orkiteError
. Opening for discussion.,