From 35b96cf89db1a2253ad4e5149013e0b2e306d726 Mon Sep 17 00:00:00 2001 From: niyatim23 Date: Wed, 10 Apr 2024 08:19:12 -0700 Subject: [PATCH] add logs --- .../kinesisvideo/signaling/okhttp/WebSocketClient.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/amazonaws/kinesisvideo/signaling/okhttp/WebSocketClient.java b/app/src/main/java/com/amazonaws/kinesisvideo/signaling/okhttp/WebSocketClient.java index 6845b1e..c4b8dcd 100644 --- a/app/src/main/java/com/amazonaws/kinesisvideo/signaling/okhttp/WebSocketClient.java +++ b/app/src/main/java/com/amazonaws/kinesisvideo/signaling/okhttp/WebSocketClient.java @@ -66,11 +66,17 @@ public void onFailure(@NonNull WebSocket webSocket, @NonNull Throwable t, Respon void send(String message) { Log.d(TAG, "Sending message: " + message); - webSocket.send(message); + if (!webSocket.send(message)) { + Log.d(TAG, "Could not send " + message + " as the connection may have " + + "closing, closed, or canceled."); + } } void disconnect() { - webSocket.close(1000, "Disconnect requested"); + if (!webSocket.close(1000, "Disconnect requested")) { + Log.d(TAG, "Websocket could not disconnect as a graceful shutdown was already " + + "underway or the web socket is already closed or canceled"); + } } boolean isOpen() {