Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions SocketIO.m
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ - (void) connectToHost:(NSString *)host

// do handshake via HTTP request
NSString *protocol = _useSecure ? @"https" : @"http";
NSString *port = _port ? [NSString stringWithFormat:@":%d", _port] : @"";
NSString *port = _port ? [NSString stringWithFormat:@":%ld", (long)_port] : @"";
NSTimeInterval time = [[NSDate date] timeIntervalSince1970] * 1000;
NSString *handshakeUrl = [NSString stringWithFormat:kHandshakeURL, protocol, _host, port, kResourceName,kTransportPolling, time, query];
//@"%@://%@%@/%@/1/?t=%.0f%@";
Expand Down Expand Up @@ -185,7 +185,7 @@ - (void) disconnect
- (void) disconnectForced
{
NSString *protocol = [self useSecure] ? @"https" : @"http";
NSString *port = _port ? [NSString stringWithFormat:@":%d", _port] : @"";
NSString *port = _port ? [NSString stringWithFormat:@":%ld", (long)_port] : @"";
NSString *urlString = [NSString stringWithFormat:kForceDisconnectURL, protocol, _host, port, kResourceName, _sid];
NSURL *url = [NSURL URLWithString:urlString];
DEBUGLOG(@"Force disconnect at: %@", urlString);
Expand Down Expand Up @@ -741,7 +741,8 @@ - (void) onData:(NSString *)data
packet.args = [parsedData subarrayWithRange:NSMakeRange(1, parsedData.count-1)];
if([packet.name isEqualToString:@"message"])
{
packet.data = packet.args[0];
// data is specified as NSString, so rewrap it...
packet.data = [SocketIOJSONSerialization JSONStringFromObject:packet.args[0] error:nil];
if ([_delegate respondsToSelector:@selector(socketIO:didReceiveMessage:)]) {
[_delegate socketIO:self didReceiveMessage:packet];
}
Expand All @@ -759,8 +760,8 @@ - (void) onData:(NSString *)data
{

if (ack > 0) {
int ackId = ack;
DEBUGLOG(@"ack id found: %d", ackId);
NSUInteger ackId = ack;
DEBUGLOG(@"ack id found: %d", (unsigned int)ackId);

NSString *argsStr = [packet.data substringFromIndex:1 ];
argsStr = [argsStr substringToIndex:argsStr.length-1];
Expand All @@ -774,7 +775,7 @@ - (void) onData:(NSString *)data
}

// get selector for ackId
NSString *key = [NSString stringWithFormat:@"%d", ackId];
NSString *key = [NSString stringWithFormat:@"%d", (unsigned int)ackId];
SocketIOCallback callbackFunction = [_acks objectForKey:key];
if (callbackFunction != nil) {
callbackFunction(argsData);
Expand Down Expand Up @@ -864,7 +865,7 @@ - (void) connection:(NSURLConnection *)connection didReceiveResponse:(NSURLRespo
// check for server status code (http://gigliwood.com/weblog/Cocoa/Q__When_is_an_conne.html)
if ([response respondsToSelector:@selector(statusCode)]) {
NSInteger statusCode = [((NSHTTPURLResponse *)response) statusCode];
DEBUGLOG(@"didReceiveResponse() %i", statusCode);
DEBUGLOG(@"didReceiveResponse() %i", (int)statusCode);

if (statusCode >= 400) {
// stop connecting; no more delegate messages
Expand Down
6 changes: 3 additions & 3 deletions SocketIOPacket.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@
@property (nonatomic, copy) NSArray *args;

- (id) initWithType:(NSString *)packetType;
- (id) initWithTypeIndex:(int)index;
- (id) initWithTypeIndex:(NSUInteger)index;
- (id) dataAsJSON;
- (NSString *) toString;
- (NSNumber *) typeAsNumber;
- (NSString *) typeForIndex:(int)index;
- (NSString *) typeForIndex:(NSUInteger)index;

+ (SocketIOPacket *) createPacketWithType:(NSString *)type
version:(SocketIOVersion) version;
+ (SocketIOPacket *) createPacketWithTypeIndex:(int) type
+ (SocketIOPacket *) createPacketWithTypeIndex:(NSUInteger) type
version:(SocketIOVersion) version;
@end

Expand Down
6 changes: 3 additions & 3 deletions SocketIOPacket.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ - (id) initWithType:(NSString *)packetType
return self;
}

- (id) initWithTypeIndex:(int)index
- (id) initWithTypeIndex:(NSUInteger)index
{
self = [self init];
if (self) {
Expand Down Expand Up @@ -132,7 +132,7 @@ - (NSNumber *) typeAsNumber
return num;
}

- (NSString *) typeForIndex:(int)index
- (NSString *) typeForIndex:(NSUInteger)index
{
return [_types objectAtIndex:index];
}
Expand All @@ -150,7 +150,7 @@ + (SocketIOPacket *) createPacketWithType:(NSString *)type
}
}

+ (SocketIOPacket *) createPacketWithTypeIndex:(int) type
+ (SocketIOPacket *) createPacketWithTypeIndex:(NSUInteger) type
version:(SocketIOVersion) version
{
switch (version) {
Expand Down
2 changes: 1 addition & 1 deletion submodules/socket-rocket