-
Notifications
You must be signed in to change notification settings - Fork 2
/
SISocketIOTransport.h
70 lines (53 loc) · 1.94 KB
/
SISocketIOTransport.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//
// SISocketIOTransport.h
// Socket.IO-iOS
//
// Created by masafumi yoshida on 2014/06/12.
// Copyright (c) 2014年 masafumi yoshida. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "SIEngineIOParser.h"
typedef enum SISocketIOTransportStatus : int {
SISocketIOTransportStatusClosed,
SISocketIOTransportStatusOpening,
SISocketIOTransportStatusOpen,
} SISocketIOTransportStatus;
@protocol SISocketIOTransport <NSObject>
+(NSString*)transportName;
-(NSString*)protocol;
-(NSString*)query;
-(void)write:(NSArray*)packets;
@end
@protocol SISocketIOTransportDelegate;
@interface SISocketIOTransport : NSObject<SISocketIOTransport>
@property (nonatomic) SISocketIOTransportStatus readyStatus;
@property (nonatomic) NSInteger timestamp;
@property (nonatomic) NSInteger timestamps;
@property (nonatomic) NSString *host;
@property (nonatomic) NSInteger port;
@property (nonatomic) NSString *sid;
@property (nonatomic) NSString *path;
@property (nonatomic) BOOL useSecure;
@property (nonatomic) BOOL upgrade;
@property (nonatomic) BOOL onlyBinaryUpgrades;
@property (nonatomic) BOOL forceJSONP;
@property (nonatomic) BOOL forceBase64;
@property (nonatomic) BOOL writable;
@property (nonatomic) SISocketIOTransport *transport;
@property (nonatomic) NSArray *transports;
@property (nonatomic) NSString *timestampParam;
@property (nonatomic) SIEngineIOParser *parser;
@property (nonatomic,weak) id <SISocketIOTransportDelegate> delegate;
-(NSString*)endpointURL;
-(void)emit:(NSString*)eventName data:(NSData*)data;
-(void)emit:(NSString*)eventName params:(NSDictionary*)params;
-(void)send:(NSArray*)data;
-(void)open;
-(void)close;
@end
@protocol SISocketIOTransportDelegate <NSObject>
- (void) onPacket:(SISocketIOTransport*)transport packet:(SIEngineIOPacket*)packet;
- (void) onOpen:(SISocketIOTransport*)transport;
- (void) onClose:(SISocketIOTransport*)transport;
- (void) onError:(SISocketIOTransport*)transport error:(NSError*)error;
@end