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

Commit c35a0d2

Browse files
committed
add examples for different event data types. ref #158
1 parent fe38fcf commit c35a0d2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

SocketTesterARC/ViewController.m

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ - (void) socketIO:(SocketIO *)socket didReceiveEvent:(SocketIOPacket *)packet
5656
{
5757
NSLog(@"didReceiveEvent()");
5858

59+
// test acknowledge
5960
SocketIOCallback cb = ^(id argsData) {
6061
NSDictionary *response = argsData;
6162
// do something with response
@@ -65,6 +66,17 @@ - (void) socketIO:(SocketIO *)socket didReceiveEvent:(SocketIOPacket *)packet
6566
[socketIO disconnectForced];
6667
};
6768
[socketIO sendMessage:@"hello back!" withAcknowledge:cb];
69+
70+
// test different event data types
71+
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
72+
[dict setObject:@"test1" forKey:@"key1"];
73+
[dict setObject:@"test2" forKey:@"key2"];
74+
[socketIO sendEvent:@"welcome" withData:dict];
75+
76+
[socketIO sendEvent:@"welcome" withData:@"testWithString"];
77+
78+
NSArray *arr = [NSArray arrayWithObjects:@"test1", @"test2", nil];
79+
[socketIO sendEvent:@"welcome" withData:arr];
6880
}
6981

7082
- (void) socketIO:(SocketIO *)socket onError:(NSError *)error

0 commit comments

Comments
 (0)