Skip to content

Commit

Permalink
Issue #172: Preventing multiple ‘openWebSocket’ calls to get executed.
Browse files Browse the repository at this point in the history
  • Loading branch information
jleandroperez committed Nov 21, 2013
1 parent bcf6400 commit bf09a02
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 6 additions & 1 deletion Simperium/SPWebSocketInterface.m
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,16 @@ - (void)authenticateChannel:(SPWebSocketChannel *)channel {
}

- (void)openWebSocket {
// Prevent multiple 'openWebSocket' calls to get executed
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(openWebSocket) object:nil];

// Open the socket!
NSString *urlString = [NSString stringWithFormat:@"%@/%@/websocket", WEBSOCKET_URL, self.simperium.appID];
SRWebSocket *newWebSocket = [[SRWebSocket alloc] initWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlString]]];
self.webSocket = newWebSocket;
self.webSocket.delegate = self;

self.open = NO;

DDLogVerbose(@"Simperium opening WebSocket connection...");
[self.webSocket open];
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>_XCCurrentVersionName</key>
<string>Simpletodo.xcdatamodel</string>
</dict>
<dict/>
</plist>

0 comments on commit bf09a02

Please sign in to comment.