diff --git a/SocketIO.h b/SocketIO.h index 67ceb23..01b38d8 100755 --- a/SocketIO.h +++ b/SocketIO.h @@ -101,6 +101,7 @@ typedef enum { @property (nonatomic, readonly) NSString *sid; @property (nonatomic, readonly) NSTimeInterval heartbeatTimeout; @property (nonatomic) BOOL useSecure; +@property (nonatomic) NSString *path; @property (nonatomic) NSArray *cookies; @property (nonatomic, readonly) BOOL isConnected, isConnecting; @property (nonatomic, weak) id delegate; diff --git a/SocketIO.m b/SocketIO.m index a2497f8..dcfa4a4 100755 --- a/SocketIO.m +++ b/SocketIO.m @@ -36,11 +36,11 @@ #define DEBUGLOG(...) #endif -static NSString* kResourceName = @"socket.io"; +static NSString* kResourceName = @"/socket.io"; static NSString* kTransportPolling = @"polling"; static NSString* kTransportWebsocket = @"websocket"; -static NSString* kHandshakeURL = @"%@://%@%@/%@/1/?EIO=2&transport=%@&t=%.0f%@"; -static NSString* kForceDisconnectURL = @"%@://%@%@/%@/1/xhr-polling/%@?disconnect"; +static NSString* kHandshakeURL = @"%@://%@%@%@%@/1/?EIO=2&transport=%@&t=%.0f%@"; +static NSString* kForceDisconnectURL = @"%@://%@%@%@%@/1/xhr-polling/%@?disconnect"; float const defaultConnectionTimeout = 10.0f; @@ -91,6 +91,7 @@ - (id) initWithDelegate:(id)delegate _ackCount = 0; _acks = [[NSMutableDictionary alloc] init]; _returnAllDataFromAck = NO; + _path=@""; } return self; } @@ -137,7 +138,7 @@ - (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,kTransportPolling, time, query]; + NSString *handshakeUrl = [NSString stringWithFormat:kHandshakeURL, protocol, _host, port, _path, kResourceName,kTransportPolling, time, query]; //@"%@://%@%@/%@/1/?t=%.0f%@"; //http:///socket.io/1/?t=