File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -27,12 +27,18 @@ socket.connect()
2727``` objective-c
2828SocketIOClient* socket = [[SocketIOClient alloc ] initWithSocketURL: @"localhost:8080" options: nil ] ;
2929
30- [ socket on: @"connect" callback: ^(NSArray* data, void (^ack)(NSArray* )) {
31- NSLog(@"connected");
32- [ socket emit:@"echo" withItems:@[ @"echo test"]] ;
33- [ socket emitWithAck:@"ackack" withItems:@[ @1 ]] (10, ^(NSArray* data) {
34- NSLog(@"Got ack");
30+ [ socket on:@"connect" callback:^(NSArray* data, void (^ack)(NSArray* )) {
31+ NSLog(@"socket connected");
32+ }] ;
33+
34+ [ socket on:@"currentAmount" callback:^(NSArray* data, void (^ack)(NSArray* )) {
35+ double cur = [[ data objectAtIndex:0] floatValue] ;
36+
37+ [socket emitWithAck:@"canUpdate" withItems:@[@(cur)]](0, ^(NSArray* data) {
38+ [socket emit:@"update" withItems:@[@(cur + 2.50)]];
3539 });
40+
41+ ack (@[ @"Got your ack, ", @"dude"] );
3642}] ;
3743
3844[ socket connect] ;
You can’t perform that action at this time.
0 commit comments