File tree 1 file changed +9
-1
lines changed
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 4
4
Socket.IO-client for iOS/OS X.
5
5
6
6
## Example
7
- ``` swift
7
+ ```
8
8
import SocketIO
9
9
10
10
let manager = SocketManager(socketURL: URL(string: "http://localhost:8080")!, config: [.log(true), .compress])
@@ -18,6 +18,10 @@ socket.on("currentAmount") {data, ack in
18
18
guard let cur = data[0] as? Double else { return }
19
19
20
20
socket.emitWithAck("canUpdate", cur).timingOut(after: 0) {data in
21
+ if data.first as? String == SocketAckValue.noAck {
22
+ // Handle ack timeout
23
+ }
24
+
21
25
socket.emit("update", ["amount": cur + 2.50])
22
26
}
23
27
@@ -43,6 +47,10 @@ SocketIOClient* socket = manager.defaultSocket;
43
47
double cur = [[ data objectAtIndex:0] floatValue] ;
44
48
45
49
[[socket emitWithAck:@"canUpdate" with:@[@(cur)]] timingOutAfter:0 callback:^(NSArray* data) {
50
+ if ([[data[0] description] isEqualToString:@"NO ACK"]) {
51
+ // Handle ack timeout
52
+ }
53
+
46
54
[socket emit:@"update" with:@[@{@"amount": @(cur + 2.50)}]];
47
55
}];
48
56
You can’t perform that action at this time.
0 commit comments