-
Notifications
You must be signed in to change notification settings - Fork 79
/
Copy pathSIOSocket.h
47 lines (37 loc) · 1.83 KB
/
SIOSocket.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//
// Socket.h
// SocketIO
//
// Created by Patrick Perini on 6/13/14.
//
//
#import <Foundation/Foundation.h>
// NSArray of these JSValue-valid objects:
typedef NSArray SIOParameterArray;
// --------------------
// NSNull
// NSString
// NSNumber
// NSDictionary
// NSArray
// NSData
// --------------------
@interface SIOSocket : NSObject
// Generators
+ (void)socketWithHost:(NSString *)hostURL response:(void(^)(SIOSocket *socket))response;
+ (void)socketWithHost:(NSString *)hostURL reconnectAutomatically:(BOOL)reconnectAutomatically attemptLimit:(NSInteger)attempts withDelay:(NSTimeInterval)reconnectionDelay maximumDelay:(NSTimeInterval)maximumDelay timeout:(NSTimeInterval)timeout response:(void(^)(SIOSocket *socket))response;
+ (void)socketWithHost:(NSString *)hostURL reconnectAutomatically:(BOOL)reconnectAutomatically attemptLimit:(NSInteger)attempts withDelay:(NSTimeInterval)reconnectionDelay maximumDelay:(NSTimeInterval)maximumDelay timeout:(NSTimeInterval)timeout withTransports:(NSArray *)transports response:(void(^)(SIOSocket *socket))response;
// Event responders
@property (nonatomic, copy) void (^onConnect)();
@property (nonatomic, copy) void (^onConnectError)(NSDictionary *errorInfo);
@property (nonatomic, copy) void (^onDisconnect)();
@property (nonatomic, copy) void (^onError)(NSDictionary *errorInfo);
@property (nonatomic, copy) void (^onReconnect)(NSInteger numberOfAttempts);
@property (nonatomic, copy) void (^onReconnectionAttempt)(NSInteger numberOfAttempts);
@property (nonatomic, copy) void (^onReconnectionError)(NSDictionary *errorInfo);
- (void)on:(NSString *)event callback:(void (^)(SIOParameterArray *args))function;
// Emitters
- (void)emit:(NSString *)event;
- (void)emit:(NSString *)event args:(SIOParameterArray *)args;
- (void)close;
@end