Skip to content

Commit

Permalink
Add isConnected
Browse files Browse the repository at this point in the history
  • Loading branch information
soffes committed Jun 2, 2012
1 parent f733f14 commit 497b6b9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions Bully/BLYClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

- (void)connect;
- (void)disconnect;
- (BOOL)isConnected;

@end

Expand Down
11 changes: 10 additions & 1 deletion Bully/BLYClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ - (BLYChannel *)subscribeToChannelWithName:(NSString *)channelName authenticatio


- (void)connect {
if (self.webSocket) {
if ([self isConnected]) {
return;
}

Expand All @@ -80,6 +80,10 @@ - (void)connect {


- (void)disconnect {
if (![self isConnected]) {
return;
}

self.webSocket = nil;
if ([self.delegate respondsToSelector:@selector(bullyClientDidDisconnect:)]) {
[self.delegate bullyClientDidDisconnect:self];
Expand All @@ -88,6 +92,11 @@ - (void)disconnect {
}


- (BOOL)isConnected {
return self.webSocket != nil;
}


#pragma mark - Private

- (void)_sendEvent:(NSString *)eventName dictionary:(NSDictionary *)dictionary {
Expand Down

0 comments on commit 497b6b9

Please sign in to comment.