-
Notifications
You must be signed in to change notification settings - Fork 312
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
Add ping and pong received callbacks #509
Conversation
It seems the tests I added are flaky. I'm investigating this. |
I've found the problem. |
a154a33
to
679b569
Compare
|
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.
Thanks for the pull request! Looks great, I just had some questions/concerns about the ping received payload modifications.
38c82dd
to
a9a6a1f
Compare
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 looks great and the docs are well written too, thanks! Once the data race in the tests is fixed, I believe this is good to go 👍🏻
a9a6a1f
to
45597ec
Compare
This change adds two optional callbacks to both `DialOptions` and `AcceptOptions`. These callbacks are invoked synchronously when a ping or pong frame is received, allowing advanced users to log or inspect payloads for metrics or debugging. If the callback needs to perform more complex work or reuse the payload outside the callback, it is recommended to perform processing in a separate goroutine. The boolean return value of `OnPingReceived` is used to determine if the subsequent pong frame should be sent. If `false` is returned, the pong frame is not sent. Tests confirm that the ping/pong callbacks are invoked as expected. References coder#246
45597ec
to
85e8670
Compare
It looks like we are now encountering an issue related to wasmbrowsertest and timeouts. I'm trying to update it to the latest version to see if that resolves the problem. This repo had a similar issue, and it looks like they fixed it by updating the version as well: hajimehoshi/ebiten#2982 [edit] Moved the fix attempt to a new PR: #514 |
1c94ea4
to
85e8670
Compare
CI is passing now. Feel free to merge this. We can discuss the flaky |
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.
Awesome, thanks for the contribution!
Hi, This is great. Any info on when the next release will be? Thanks to all the maintainers and contributors! |
Add ping and pong received callbacks
This change adds two optional callbacks to both
DialOptions
andAcceptOptions
. These callbacks are invoked synchronously when a pingor pong frame is received, allowing advanced users to log or inspect
payloads for metrics or debugging. If the callback needs to perform more
complex work or reuse the payload outside the callback, it is
recommended to perform processing in a separate goroutine.
The boolean return value of
OnPingReceived
is used to determine if thesubsequent pong frame should be sent. If
false
is returned, the pongframe is not sent.
Tests confirm that the ping/pong callbacks are invoked as expected.
Fixes #246
Closes #307