Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

Commit 54b2289

Browse files
committed
try forced disconnect in SocketTester example
1 parent afacfb9 commit 54b2289

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

SocketTesterARC/ViewController.m

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ - (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfac
3636
}
3737

3838

39-
39+
- (void) socketIODidConnect:(SocketIO *)socket
40+
{
41+
NSLog(@"socket.io connected.");
42+
}
4043

4144
- (void) socketIO:(SocketIO *)socket didReceiveEvent:(SocketIOPacket *)packet
4245
{
@@ -46,14 +49,24 @@ - (void) socketIO:(SocketIO *)socket didReceiveEvent:(SocketIOPacket *)packet
4649
NSDictionary *response = argsData;
4750
// do something with response
4851
NSLog(@"ack arrived: %@", response);
52+
53+
// test forced disconnect
54+
[socketIO disconnectForced];
4955
};
5056
[socketIO sendMessage:@"hello back!" withAcknowledge:cb];
5157
}
5258

53-
- (void) socketIO:(SocketIO *)socket failedToConnectWithError:(NSError *)error
59+
- (void) socketIO:(SocketIO *)socket onError:(NSError *)error
60+
{
61+
NSLog(@"onError() %@", error);
62+
}
63+
64+
65+
- (void) socketIODidDisconnect:(SocketIO *)socket disconnectedWithError:(NSError *)error
5466
{
55-
NSLog(@"failedToConnectWithError() %@", error);
67+
NSLog(@"socket.io disconnected. did error occur? %@", error);
5668
}
5769

5870

71+
5972
@end

0 commit comments

Comments
 (0)