Skip to content

Commit

Permalink
fix: properly handle goodbye reconnection
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumelamirand committed Mar 5, 2024
1 parent 3321dcf commit 4f92d83
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,11 @@ protected Completable handleGoodByeCommand(final Command<?> command, final Comma
return handleCommand(command, commandHandler, true)
.doOnSuccess(reply -> {
if (reply.getCommandStatus() == CommandStatus.SUCCEEDED) {
Payload payload = reply.getPayload();
if (payload instanceof GoodByeCommandPayload goodByeCommandPayload) {
short statusCode = 1000;
if (goodByeCommandPayload.isReconnect()) {
statusCode = 1013;
}
webSocket.close(statusCode, "GoodBye Command with reconnection requested.").subscribe();
Payload payload = command.getPayload();
if (payload instanceof GoodByeCommandPayload goodByeCommandPayload && goodByeCommandPayload.isReconnect()) {
webSocket.close((short) 1013, "GoodBye Command with reconnection requested.").subscribe();
} else {
webSocket.close((short) 1000, "GoodBye Command without reconnection.").subscribe();
}
}
})
Expand Down

0 comments on commit 4f92d83

Please sign in to comment.