-
Notifications
You must be signed in to change notification settings - Fork 7
Custom close codes #16
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
4c05cc9 to
15cf013
Compare
|
Here we go, took a lot of retries but I got it right (PC format and my git config wasn't quite right). @rawhat Ready for review :) Planning to add some features later on (more close reasons, |
|
By the way, I actually implemented an on_close function with close reasons (to be able to pattern match based on what we receive from the server), I'll make a new one once this is merged, please don't make a release until then (to avoid two major releases) |
|
@rawhat Cleaned up the mess :) |
At least I hope I can, I haven't dived into stacked PRs before 😅 |
| } | ||
|
|
||
| /// This closes the WebSocket connection with a particular close reason. | ||
| pub fn close_with_reason( |
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.
from an ergonomics perspective, do you think making the CloseReason non-opaque and just keeping the close and close_with_reason as the only public functions? i'm not really a user of this library, so curious about your perspective
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.
Now that I think about it, I think you got a point. The only close reason that actually needs to be opaque is the custom one, so that could be in its own opaque type with its own function. I'll get around to it in a few. It could introduce some naming problems with sent and received close reasons, but it's not anything we can't figure out.
Signed-off-by: Filip Hoffmann <folosp@protonmail.com>
Signed-off-by: Filip Hoffmann <folosp@protonmail.com>
|
I also added some labels and bugfixes (preventing negative and invaid close codes), I hope these won't be an issue (I should've split commits 😞) |
|
Thank you! |
See rawhat/gramps#3.
In essence, in addition to the standard 1000 close codes, APIs can define their own. This PR brings things up to date with the gramps PR.
Note: PR is a draft because it currently has a git dependency on my fork. Will change once gramps PR is approved and pushed to Hex.