private void HandleMessageReceived(RealtimeTransportData data) { if (data.IsBinary) { if (Logger.IsDebug) { try { #if MSGPACK var message = MsgPackHelper.DeserialiseMsgPackObject(data.Data).ToString(); Logger.Debug("Websocket data message received. Raw: " + message); #endif } catch (Exception) { Logger.Debug("Error parsing message as MsgPack."); } } Listener?.OnTransportDataReceived(data); } else { if (Logger.IsDebug) { Logger.Debug("Websocket message received. Raw: " + data.Text); } Listener?.OnTransportDataReceived(data); } }
private void LogRequestBody(byte[] requestBody) { try { var body = MsgPackHelper.DeserialiseMsgPackObject(requestBody)?.ToString(); Logger.Debug("RequestBody: " + (body ?? "No body present")); } catch (Exception ex) { Logger.Error("Error while logging request body.", ex); } }
private void LogRequestBody(byte[] requestBody) { try { #if MSGPACK var body = MsgPackHelper.DeserialiseMsgPackObject(requestBody)?.ToString(); Logger.Debug("RequestBody: " + (body ?? "No body present")); #else Logger.Debug("RequestBody: MsgPack disabled, cannot log request"); #endif } catch (Exception ex) { Logger.Error("Error while logging request body.", ex); } }
private void LogResponse(AblyResponse response) { if (Logger.IsDebug) { Logger.Debug("Protocol:" + _protocol); try { var responseBody = response.TextResponse; if (_protocol == Protocol.MsgPack && response.Body != null) { responseBody = MsgPackHelper.DeserialiseMsgPackObject(response.Body).ToString(); } Logger.Debug("Response: " + responseBody); } catch (Exception ex) { Logger.Error("Error while logging response body.", ex); } } }