Socket Management

pull/1/head
Frederic Jacobs 11 years ago
parent 9b5379b3e2
commit 6446c6fbe0

@ -208,6 +208,7 @@
}
-(void) applicationDidBecomeActive:(UIApplication *)application {
[TSSocketManager becomeActive];
[AppAudioManager.sharedInstance awake];
// Hacky way to clear notification center after processed push
@ -231,8 +232,8 @@
completionHandler();
}
- (void)applicationWillResignActive:(UIApplication *)application{
[self protectScreen];
- (void)applicationDidEnterBackground:(UIApplication *)application{
[TSSocketManager resignActivity];
}
- (void)prepareScreenshotProtection{

@ -163,7 +163,12 @@ NSString * const SocketConnectingNotification = @"SocketConnectingNotification";
[message setResponse:response.build];
[message setType:WebSocketMessageTypeResponse];
[self.websocket send:message.build.data];
@try {
[self.websocket send:message.build.data];
}
@catch (NSException *exception) {
DDLogWarn(@"Caught exception while trying to write on the socket %@", exception.debugDescription);
}
}
- (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean {
@ -174,7 +179,12 @@ NSString * const SocketConnectingNotification = @"SocketConnectingNotification";
}
- (void)webSocketHeartBeat {
[self.websocket sendPing:nil];
@try {
[self.websocket sendPing:nil];
}
@catch (NSException *exception) {
DDLogWarn(@"Caught exception while trying to write on the socket %@", exception.debugDescription);
}
}
- (NSString*)webSocketAuthenticationString{

@ -23,7 +23,6 @@
}
NSData *identityKey = [NSData dataFromBase64String:identityKeyString];
NSLog(@"IDentityKey %@", identityKey);
for (NSDictionary *deviceDict in devicesArray) {
NSNumber *registrationIdString = [deviceDict objectForKey:@"registrationId"];

Loading…
Cancel
Save