@@ -61,9 +61,9 @@ public void close() {
6161 readyState = 2 ; // CLOSING
6262 webSocket .close (1000 , "Normal closure" );
6363 Log .d ("WebSocketInstance" , "websocket instanceId=" + this .instanceId + " received close() action call" );
64+ } else {
65+ Log .d ("WebSocketInstance" , "websocket instanceId=" + this .instanceId + " received close() action call, ignoring... as webSocket is null (not present)" );
6466 }
65-
66- Log .d ("WebSocketInstance" , "websocket instanceId=" + this .instanceId + " received close() action call, ignoring... as webSocket is null (not present)" );
6767 }
6868
6969 @ Override
@@ -84,10 +84,16 @@ public void onMessage(@NonNull WebSocket webSocket, String text) {
8484 @ Override
8585 public void onClosing (WebSocket webSocket , int code , String reason ) {
8686 this .readyState = 2 ; // CLOSING
87- sendEvent ("close" , reason );
8887 Log .i ("WebSocketInstance" , "websocket instanceId=" + this .instanceId + " is Closing code: " + code + " reason: " + reason );
8988 }
9089
90+ @ Override
91+ public void onClosed (WebSocket webSocket , int code , String reason ) {
92+ this .readyState = 3 ; // CLOSED
93+ sendEvent ("close" , reason );
94+ Log .i ("WebSocketInstance" , "websocket instanceId=" + this .instanceId + " Closed code: " + code + " reason: " + reason );
95+ }
96+
9197 @ Override
9298 public void onFailure (WebSocket webSocket , Throwable t , Response response ) {
9399 this .readyState = 3 ; // CLOSED
0 commit comments