-
Notifications
You must be signed in to change notification settings - Fork 30
Websocket 1.1.0 proposal #19
base: master
Are you sure you want to change the base?
Conversation
This reverts commit c4994fe.
Thanks for the pull request! Make sure it satisfies this checklist. My human colleagues will appreciate it! Here is what to expect next, and if anyone wants to comment, keep these things in mind. |
The hero we needed. I very much approve these changes and I hope you get more feedback. |
Good stuff. We have a dashboard that traces logs in real-time and can connect to individual servers to trace running processes using websockets. You have to be on the VPN in order for this functionality to work. Having these additions would allow us to make the user experience much better when the user is not connected to the VPN (i.e. actually tell them they might need to connect). This is long overdue! :) |
Quick update: I've updated the proposal (not the pull request) to not change message queuing/save behavior. I did this for a couple reasons:
I did add another item to the proposal, and that is resetting the reconnect backoff when the page becomes visible. This would make reconnects immediate when the user opens the tab, instead of having to potentially wait minutes for the reconnect to happen. |
I think disabling queuing can be done without a major version bump, by adding additional constructor. We would have : type MySub msg
= Listen String Bool (String -> msg)
| KeepAlive String
listen : String -> (String -> msg) -> Sub msg
listen url tagger =
subscription True (Listen url tagger)
listenNoQueuing : String -> (String -> msg) -> Sub msg
listenNoQueuing url tagger =
subscription False (Listen url tagger) |
based on elm-lang/websocket#19 - merged with binary data support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that can be of any help, I just have one comment about this PR. It LGTM although I don't have enough experience for that to be worth something.
What's the next step for this, can I help in some way? Maybe by doing some tests on my side?
@@ -1,5 +1,5 @@ | |||
{ | |||
"version": "1.0.2", | |||
"version": "2.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should become 1.1.0 I suppose
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ibizaman the public function keepAlive
no longer exists, making this a breaking change for consumers. Hence a major version bump is mandatory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is a proposal, and while it's a breaking change as-is, if something were to be decided on where this PR could be cleaned up for actual merging, the intent would be to make it non-breaking.
First, I would like to express my support for this patch. I would then like to request an additional feature. I would like the |
Proposed changes
Add
onOpen
andonClose
subscriptionsThis would fix #14 and #10 and was my primary motivation for proposing these changes. These subscriptions are important for pretty much any non-trivial scenario, and appears to be the most requested feature for the websocket package.
Reset backoff when page becomes visible
With exponential backoff fixed, reconnect attempts occur far less frequently than when it was broken. It makes sense to reset the backoff when the page becomes visible, otherwise, the user would have to refresh the page if they want the application to reconnect immediately.
Feedback
This pull request is the result of my hacking over the weekend and there are probably issues or things that need to be cleaned up. I also removed
keepAlive
temporarily just to make it easier to hack in the proposed changes. I'm interested in hearing feedback for the proposed changes, and if/when something concrete is decided, I will clean up this PR.