-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: count ping as websocket activity #203
Conversation
denopink
commented
Jul 31, 2024
- count ping as websocket activity
- lack of activity will trigger inactivityTimeout, causing the websocket connection to close and reconnect
- count ping as websocket activity - lack of activity will trigger inactivityTimeout, causing the websocket connection to close and reconnect
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #203 +/- ##
==========================================
+ Coverage 76.97% 77.01% +0.04%
==========================================
Files 75 75
Lines 4542 4550 +8
==========================================
+ Hits 3496 3504 +8
Misses 848 848
Partials 198 198
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -289,22 +291,32 @@ func (ws *Websocket) run(ctx context.Context) { | |||
// Read loop | |||
for { | |||
var msg wrp.Message | |||
ctx, cancel := context.WithTimeout(ctx, ws.inactivityTimeout) | |||
typ, reader, err := ws.conn.Reader(ctx) |
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.
we want to include the activity from pings. that requires us to manually trigger a timeout.
Otherwise, the device will reconnect in intervals of ws.inactivityTimeout
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.
that looks good!