|
@@ -33,6 +33,7 @@ import com.nextcloud.talk.models.database.UserEntity;
|
|
|
import com.nextcloud.talk.models.json.signaling.NCMessageWrapper;
|
|
|
import com.nextcloud.talk.models.json.signaling.NCSignalingMessage;
|
|
|
import com.nextcloud.talk.models.json.websocket.*;
|
|
|
+import com.nextcloud.talk.utils.LoggingUtils;
|
|
|
import com.nextcloud.talk.utils.MagicMap;
|
|
|
import com.nextcloud.talk.utils.singletons.MerlinTheWizard;
|
|
|
import com.novoda.merlin.Endpoint;
|
|
@@ -143,6 +144,9 @@ public class MagicWebSocketInstance extends WebSocketListener {
|
|
|
public void onMessage(WebSocket webSocket, String text) {
|
|
|
if (webSocket == internalWebSocket) {
|
|
|
Log.d(TAG, "Receiving : " + text);
|
|
|
+ LoggingUtils.writeLogEntryToFile(context,
|
|
|
+ "WebSocket " + webSocket.hashCode() + " receiving: " + text);
|
|
|
+
|
|
|
try {
|
|
|
BaseWebSocketMessage baseWebSocketMessage = LoganSquare.parse(text, BaseWebSocketMessage.class);
|
|
|
String messageType = baseWebSocketMessage.getType();
|
|
@@ -166,6 +170,8 @@ public class MagicWebSocketInstance extends WebSocketListener {
|
|
|
case "error":
|
|
|
ErrorOverallWebSocketMessage errorOverallWebSocketMessage = LoganSquare.parse(text, ErrorOverallWebSocketMessage.class);
|
|
|
if (("no_such_session").equals(errorOverallWebSocketMessage.getErrorWebSocketMessage().getCode())) {
|
|
|
+ LoggingUtils.writeLogEntryToFile(context,
|
|
|
+ "WebSocket " + webSocket.hashCode() + " resumeID " + resumeId + " expired");
|
|
|
resumeId = "";
|
|
|
restartWebSocket();
|
|
|
} else if (("hello_expected").equals(errorOverallWebSocketMessage.getErrorWebSocketMessage().getCode())) {
|
|
@@ -250,7 +256,9 @@ public class MagicWebSocketInstance extends WebSocketListener {
|
|
|
break;
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
|
- Log.e(TAG, "Failed to WebSocket message");
|
|
|
+ LoggingUtils.writeLogEntryToFile(context,
|
|
|
+ "WebSocket " + webSocket.hashCode() + " IOException: " + e.getMessage());
|
|
|
+ Log.e(TAG, "Failed to recognize WebSocket message");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -263,11 +271,15 @@ public class MagicWebSocketInstance extends WebSocketListener {
|
|
|
@Override
|
|
|
public void onClosing(WebSocket webSocket, int code, String reason) {
|
|
|
Log.d(TAG, "Closing : " + code + " / " + reason);
|
|
|
+ LoggingUtils.writeLogEntryToFile(context,
|
|
|
+ "WebSocket " + webSocket.hashCode() + " Closing: " + reason);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onFailure(WebSocket webSocket, Throwable t, Response response) {
|
|
|
Log.d(TAG, "Error : " + t.getMessage());
|
|
|
+ LoggingUtils.writeLogEntryToFile(context,
|
|
|
+ "WebSocket " + webSocket.hashCode() + " onFailure: " + t.getMessage());
|
|
|
closeWebSocket(webSocket);
|
|
|
restartWebSocket();
|
|
|
}
|
|
@@ -302,6 +314,8 @@ public class MagicWebSocketInstance extends WebSocketListener {
|
|
|
internalWebSocket.send(message);
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
|
+ LoggingUtils.writeLogEntryToFile(context,
|
|
|
+ "WebSocket sendCalLMessage: " + e.getMessage() + "\n" + ncMessageWrapper.toString());
|
|
|
Log.e(TAG, "Failed to serialize signaling message");
|
|
|
}
|
|
|
}
|
|
@@ -321,6 +335,8 @@ public class MagicWebSocketInstance extends WebSocketListener {
|
|
|
internalWebSocket.send(message);
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
|
+ LoggingUtils.writeLogEntryToFile(context,
|
|
|
+ "WebSocket requestOfferForSessionIdWithType: " + e.getMessage() + "\n" + sessionIdParam + " " + roomType);
|
|
|
Log.e(TAG, "Failed to offer request");
|
|
|
}
|
|
|
}
|