-
Notifications
You must be signed in to change notification settings - Fork 156
WebSocket wrapper + WebSocket example update #442
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
Conversation
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.
Looking awesome! Any thoughts on implementing an optional reconnect pattern? I’ve implemented this pattern a year or so ago when I was hacking on Gloo a bit. Happy to grab that code and share it here if you like the idea.
See https://github.com/MartinKavik/seed/pull/1/files. I decided to add @thedodd What do you think? |
Solid. IMHO, one of the more fundamental libraries needs to build a higher-level WebSocket abstraction, something directly on top of WebSys but which provides the async/await & optional reconnect behavior so that it could be cleanly encapsulated. I would suggest Gloo, but I had some not-so-great experiences trying to get things done there. I had a working implementation previously, but it was based on fut01 (back in the day). Hopefully I'll have the time to just extract that code and publish as a standalone crate. If it is good, we could potentially bring it under the Seed org as well. Thoughts? |
How it differs from the code in this PR? |
Yea, I haven't touched the code in quite some time, but it is still there: https://github.com/thedodd/gloo/tree/49-websocket/crates/websocket I'll try to get it resurrected and in its own crate here soon. |
@MartinKavik the code that I linked to (which is incomplete), fully encapsulates the reconnect logic. It exposes an option to configure reconnects, and then exposes the connection state as a stream or directly readable value. Basically no boilerplate for the user. We certainly don't need that here, but I figured I would at least bring it up because I had been hacking on it before. |
|
Resolves #8