Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send more info on disconnected event #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mdiebolt
Copy link
Collaborator

@mdiebolt mdiebolt commented May 9, 2017

We don't currently send any data to the disconnected handler. In order to debug, I'd like to send more information along to the help identify disconnects. Specifically, I'm looking for CloseEvent.close and CloseEvent.reason from http://stackoverflow.com/questions/18803971/websocket-onerror-how-to-read-error-description

@mdiebolt mdiebolt requested review from bradgessler, steel and adam-h May 9, 2017 22:12
@@ -108,7 +108,7 @@ class LongPollTransport extends Transport

unless @_needToNotifyOfReconnect or @_stopRequestLoop
@_needToNotifyOfReconnect = true
@config.disconnected()
@config.disconnected(jqXhr, status, error)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What type is the event that's passed to this from the websocket versions? As I'd at least like the first parameter to be a similar type across them both, my guess that in this case error may match better as a first argument.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, make sure we can determine if it was long poll or web socket in the handler. If the event doesn't include something we can use (somewhat clearly) then I'd suggest another parameter of just long-poll or similar

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was on the fence about this. I think it's a bit different across transports, since this is the result from a rejected jQuery promise whereas the WebSockets one is a CloseEvent specific to WebSockets.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine switching to just the error object if you think that's better. Should we pass the transport type in all the events (connected, disconnected, failed, error)?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, yes. Although as the other events already have some data passed in, it would be hard to define a standard way. Perhaps that change would be better waiting for a rewrite/refactor/v2 to standardize them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants