-
Notifications
You must be signed in to change notification settings - Fork 79
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: websocket: support no response. #355
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #355 +/- ##
==========================================
- Coverage 78.50% 78.45% -0.05%
==========================================
Files 25 25
Lines 2405 2423 +18
==========================================
+ Hits 1888 1901 +13
- Misses 410 414 +4
- Partials 107 108 +1 ☔ View full report in Codecov by Sentry. |
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 also need to handle the case OnMessage() returning nil in handlePlainHTTPRequest. However, there we MUST send a response (because plain HTTP), so if nil, we must substitute it by empty message. And add a test for plain http too - ideally use one test iterating over both transports.
@@ -264,6 +264,10 @@ func (s *server) handleWSConnection(reqCtx context.Context, wsConn *websocket.Co | |||
} | |||
|
|||
response := connectionCallbacks.OnMessage(msgContext, agentConn, &request) |
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.
Please also update doc-comment for OnMessage. It currently says "Must return a ServerToAgent message...".
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.
Done.
Resolves #346
https://opentelemetry.io/docs/specs/opamp/#websocket-message-exchange
The specification does not require that we must respond to client messages in WebSocket, and we should support not responding to messages. This will reduce sending empty responses.