From c7e5d27b135d31e4ce81f066176b1719659c0e14 Mon Sep 17 00:00:00 2001 From: Philipp Kyeck Date: Sun, 23 Mar 2014 12:40:23 +0100 Subject: [PATCH 01/21] update changelog to v0.5.2 --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ea27ee..d8e6d68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.5.2 (2014-03-23) + + - check HTTP status code of NSURLConnection responses during xhr polling transport + + ## 0.5.1 (2014-03-14) - add method to pass cookies on handshake From 883b99aa87155365ad40787e7d954beb22ce4bbc Mon Sep 17 00:00:00 2001 From: Philipp Kyeck Date: Wed, 18 Jun 2014 20:55:19 +0200 Subject: [PATCH 02/21] add note about v1.0 --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 2e8fca9..acfa5f9 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ +--- +**The current version of this library does not yet support socket.io v1.0. +So if you want to use socket.io-objc, please fall back to v0.9.x.** + +--- + # Socket.IO / Objective C Library Interface to communicate between Objective C and [Socket.IO](http://socket.io/) From 7ccd121acfb350ade2389718ea3929f40ffeb578 Mon Sep 17 00:00:00 2001 From: Philipp Kyeck Date: Wed, 18 Jun 2014 20:55:59 +0200 Subject: [PATCH 03/21] add note about v1.0 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index acfa5f9..cff7233 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ --- + **The current version of this library does not yet support socket.io v1.0. So if you want to use socket.io-objc, please fall back to v0.9.x.** From 349584e72712fc6d7edaa3b125d3b89e3b2c5cea Mon Sep 17 00:00:00 2001 From: Philipp Kyeck Date: Wed, 18 Jun 2014 21:02:43 +0200 Subject: [PATCH 04/21] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index cff7233..ef65765 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ ---- - **The current version of this library does not yet support socket.io v1.0. So if you want to use socket.io-objc, please fall back to v0.9.x.** From 1abdd750493ab725ed41159c4161128653fd4af3 Mon Sep 17 00:00:00 2001 From: temasys support Date: Fri, 27 Jun 2014 17:17:21 +0800 Subject: [PATCH 05/21] [ENH]Support for socket.io 1.0.x Support is only for send message/send JSON/send event without ack. Binary are not supported. --- SocketIO.h | 6 + SocketIO.m | 714 ++++++++++++++++++++++++----------- SocketIOJSONSerialization.m | 3 +- SocketIOPacket.h | 8 + SocketIOPacket.m | 138 ++++++- SocketIOTransport.h | 8 + SocketIOTransportWebsocket.m | 23 +- SocketIOTransportXHR.m | 6 + submodules/socket-rocket | 2 +- 9 files changed, 658 insertions(+), 250 deletions(-) diff --git a/SocketIO.h b/SocketIO.h index 2fbb12e..67ceb23 100755 --- a/SocketIO.h +++ b/SocketIO.h @@ -21,6 +21,7 @@ #import #import "SocketIOTransport.h" +#import "SocketIOPacket.h" @class SocketIO; @class SocketIOPacket; @@ -41,6 +42,7 @@ typedef enum { } SocketIOErrorCodes; + @protocol SocketIODelegate @optional - (void) socketIODidConnect:(SocketIO *)socket; @@ -61,6 +63,8 @@ typedef enum { NSString *_endpoint; NSDictionary *_params; + SocketIOVersion _version; + __weak id _delegate; NSObject *_transport; @@ -75,7 +79,9 @@ typedef enum { // heartbeat NSTimeInterval _heartbeatTimeout; + NSTimeInterval _connectionTimeout; dispatch_source_t _timeout; + dispatch_source_t _heartbeat; NSMutableArray *_queue; diff --git a/SocketIO.m b/SocketIO.m index 61ff67a..63b9dc5 100755 --- a/SocketIO.m +++ b/SocketIO.m @@ -37,7 +37,9 @@ #endif static NSString* kResourceName = @"socket.io"; -static NSString* kHandshakeURL = @"%@://%@%@/%@/1/?t=%.0f%@"; +static NSString* kTransportPolling = @"polling"; +static NSString* kTransportWebsocket = @"websocket"; +static NSString* kHandshakeURL = @"%@://%@%@/%@/1/?EIO=2&transport=%@&t=%.0f%@"; static NSString* kForceDisconnectURL = @"%@://%@%@/%@/1/xhr-polling/%@?disconnect"; float const defaultConnectionTimeout = 10.0f; @@ -55,11 +57,10 @@ - (NSArray*) arrayOfCaptureComponentsMatchedByRegex:(NSString*)regex; - (void) setTimeout; - (void) onTimeout; +- (void) sendHeartbeat; - (void) onConnect:(SocketIOPacket *)packet; - (void) onDisconnect:(NSError *)error; - - (void) sendDisconnect; -- (void) sendHearbeat; - (void) send:(SocketIOPacket *)packet; - (NSString *) addAcknowledge:(SocketIOCallback)function; @@ -136,7 +137,9 @@ - (void) connectToHost:(NSString *)host NSString *protocol = _useSecure ? @"https" : @"http"; NSString *port = _port ? [NSString stringWithFormat:@":%d", _port] : @""; NSTimeInterval time = [[NSDate date] timeIntervalSince1970] * 1000; - NSString *handshakeUrl = [NSString stringWithFormat:kHandshakeURL, protocol, _host, port, kResourceName, time, query]; + NSString *handshakeUrl = [NSString stringWithFormat:kHandshakeURL, protocol, _host, port, kResourceName,kTransportPolling, time, query]; + //@"%@://%@%@/%@/1/?t=%.0f%@"; + //http:///socket.io/1/?t=