Skip to content

Commit 3f7f483

Browse files
committed
Adding comment to explain last message when closing the websocket service
1 parent 83b4c54 commit 3f7f483

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/request/service/WebSocketRequestService.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@ private Request getRequest() {
140140
@Override
141141
public void stop() {
142142
if (hasStopped.compareAndSet(false, true)) {
143+
/*
144+
Sending last message as explained in the spec:
145+
https://opentelemetry.io/docs/specs/opamp/#websocket-transport-opamp-client-initiated.
146+
The client implementation must ensure that the "agent_disconnect" field will be provided in the
147+
next supplied request body.
148+
*/
143149
doSendRequest();
144150
webSocket.close(WEBSOCKET_NORMAL_CLOSURE_CODE, null);
145151
executorService.shutdown();

0 commit comments

Comments
 (0)