diff --git a/SocketIOPacket.m b/SocketIOPacket.m index cdac17c..c31cce8 100644 --- a/SocketIOPacket.m +++ b/SocketIOPacket.m @@ -78,7 +78,8 @@ - (id) dataAsJSON - (NSString *) toString { - NSMutableArray *encoded = [NSMutableArray arrayWithObject:[self typeAsNumber]]; + NSNumber *typeAsNumber = [self typeAsNumber]; + NSMutableArray *encoded = [NSMutableArray arrayWithObject:typeAsNumber]; NSString *pIdL = self.pId != nil ? self.pId : @""; @@ -88,6 +89,11 @@ - (NSString *) toString { pIdL = [pIdL stringByAppendingString:@"+"]; } + } else { + // Engine.IO 1.0 expects payload with the ping packet + if ([typeAsNumber intValue] == 2) { + [encoded addObject:@"probe"]; + } } // Do not write pid for acknowledgements