Index: talk/examples/objc/AppRTCDemo/ARDWebSocketChannel.m |
diff --git a/talk/examples/objc/AppRTCDemo/ARDWebSocketChannel.m b/talk/examples/objc/AppRTCDemo/ARDWebSocketChannel.m |
index 27dd25d2c2d65781348598fa94ee85b3432f6751..f25e9d08bbf5fe565e56047fc06af5f122e89215 100644 |
--- a/talk/examples/objc/AppRTCDemo/ARDWebSocketChannel.m |
+++ b/talk/examples/objc/AppRTCDemo/ARDWebSocketChannel.m |
@@ -27,6 +27,7 @@ |
#import "ARDWebSocketChannel.h" |
+#import "ARDLogging.h" |
#import "ARDUtilities.h" |
#import "SRWebSocket.h" |
@@ -57,7 +58,7 @@ static NSString const *kARDWSSMessagePayloadKey = @"msg"; |
_delegate = delegate; |
_socket = [[SRWebSocket alloc] initWithURL:url]; |
_socket.delegate = self; |
- NSLog(@"Opening WebSocket."); |
+ ARDLog(@"Opening WebSocket."); |
[_socket open]; |
} |
return self; |
@@ -104,12 +105,12 @@ static NSString const *kARDWSSMessagePayloadKey = @"msg"; |
NSString *messageString = |
[[NSString alloc] initWithData:messageJSONObject |
encoding:NSUTF8StringEncoding]; |
- NSLog(@"C->WSS: %@", messageString); |
+ ARDLog(@"C->WSS: %@", messageString); |
[_socket send:messageString]; |
} else { |
NSString *dataString = |
[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; |
- NSLog(@"C->WSS POST: %@", dataString); |
+ ARDLog(@"C->WSS POST: %@", dataString); |
NSString *urlString = |
[NSString stringWithFormat:@"%@/%@/%@", |
[_restURL absoluteString], _roomId, _clientId]; |
@@ -126,7 +127,7 @@ static NSString const *kARDWSSMessagePayloadKey = @"msg"; |
return; |
} |
[_socket close]; |
- NSLog(@"C->WSS DELETE rid:%@ cid:%@", _roomId, _clientId); |
+ ARDLog(@"C->WSS DELETE rid:%@ cid:%@", _roomId, _clientId); |
NSString *urlString = |
[NSString stringWithFormat:@"%@/%@/%@", |
[_restURL absoluteString], _roomId, _clientId]; |
@@ -140,7 +141,7 @@ static NSString const *kARDWSSMessagePayloadKey = @"msg"; |
#pragma mark - SRWebSocketDelegate |
- (void)webSocketDidOpen:(SRWebSocket *)webSocket { |
- NSLog(@"WebSocket connection opened."); |
+ ARDLog(@"WebSocket connection opened."); |
self.state = kARDSignalingChannelStateOpen; |
if (_roomId.length && _clientId.length) { |
[self registerWithCollider]; |
@@ -154,24 +155,24 @@ static NSString const *kARDWSSMessagePayloadKey = @"msg"; |
options:0 |
error:nil]; |
if (![jsonObject isKindOfClass:[NSDictionary class]]) { |
- NSLog(@"Unexpected message: %@", jsonObject); |
+ ARDLog(@"Unexpected message: %@", jsonObject); |
return; |
} |
NSDictionary *wssMessage = jsonObject; |
NSString *errorString = wssMessage[kARDWSSMessageErrorKey]; |
if (errorString.length) { |
- NSLog(@"WSS error: %@", errorString); |
+ ARDLog(@"WSS error: %@", errorString); |
return; |
} |
NSString *payload = wssMessage[kARDWSSMessagePayloadKey]; |
ARDSignalingMessage *signalingMessage = |
[ARDSignalingMessage messageFromJSONString:payload]; |
- NSLog(@"WSS->C: %@", payload); |
+ ARDLog(@"WSS->C: %@", payload); |
[_delegate channel:self didReceiveMessage:signalingMessage]; |
} |
- (void)webSocket:(SRWebSocket *)webSocket didFailWithError:(NSError *)error { |
- NSLog(@"WebSocket error: %@", error); |
+ ARDLog(@"WebSocket error: %@", error); |
self.state = kARDSignalingChannelStateError; |
} |
@@ -179,7 +180,7 @@ static NSString const *kARDWSSMessagePayloadKey = @"msg"; |
didCloseWithCode:(NSInteger)code |
reason:(NSString *)reason |
wasClean:(BOOL)wasClean { |
- NSLog(@"WebSocket closed with code: %ld reason:%@ wasClean:%d", |
+ ARDLog(@"WebSocket closed with code: %ld reason:%@ wasClean:%d", |
(long)code, reason, wasClean); |
NSParameterAssert(_state != kARDSignalingChannelStateError); |
self.state = kARDSignalingChannelStateClosed; |
@@ -204,7 +205,7 @@ static NSString const *kARDWSSMessagePayloadKey = @"msg"; |
error:nil]; |
NSString *messageString = |
[[NSString alloc] initWithData:message encoding:NSUTF8StringEncoding]; |
- NSLog(@"Registering on WSS for rid:%@ cid:%@", _roomId, _clientId); |
+ ARDLog(@"Registering on WSS for rid:%@ cid:%@", _roomId, _clientId); |
// Registration can fail if server rejects it. For example, if the room is |
// full. |
[_socket send:messageString]; |