Skip to content

Commit

Permalink
Updated onClose Subscription websocket so it can reconnect when conne…
Browse files Browse the repository at this point in the history
…ction is closed
  • Loading branch information
Chintan Patel authored and Chintan Patel committed Sep 14, 2024
1 parent 28c5922 commit df7f9b7
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,15 @@ public void onMessage(String message) {
public void onClose(int code, String reason, boolean remote) {
System.out.println(
"Connection closed by " + (remote ? "remote peer" : "us") + " Code: " + code + " Reason: " + reason);

try {
boolean connected = reconnectBlocking();
while (!connected) {
Thread.sleep(1000);
connected = reconnectBlocking();
}
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}

@Override
Expand Down

0 comments on commit df7f9b7

Please sign in to comment.