Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

Commit c53d069

Browse files
committed
clean code
1 parent b28b395 commit c53d069

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

SocketIOTransportXHR.m

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,15 +206,13 @@ - (void) connection:(NSURLConnection *)connection didFailWithError:(NSError *)er
206206
}
207207
}
208208

209-
// Sometimes Socket.IO "batches" up messages in one packet,
210-
// so we have to split them.
211-
//
209+
// Sometimes Socket.IO "batches" up messages in one packet, so we have to split them.
212210
- (NSArray *)packetsFromPayload:(NSString *)payload
213211
{
214212
// "Batched" format is:
215213
// �[packet_0 length]�[packet_0]�[packet_1 length]�[packet_1]�[packet_n length]�[packet_n]
216214

217-
if([payload hasPrefix:@"\ufffd"]) {
215+
if ([payload hasPrefix:@"\ufffd"]) {
218216
// Payload has multiple packets, split based on the '�' character
219217
// Skip the first character, then split
220218
NSArray *split = [[payload substringFromIndex:1] componentsSeparatedByString:@"\ufffd"];
@@ -224,14 +222,15 @@ - (NSArray *)packetsFromPayload:(NSString *)payload
224222

225223
// Now all of the odd-numbered indices are the packets (1, 3, 5, etc.)
226224
[split enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
227-
if(idx % 2 != 0) {
225+
if (idx % 2 != 0) {
228226
[packets addObject:obj];
229227
}
230228
}];
231229

232230
NSLog(@"Parsed a payload!");
233231
return packets;
234-
} else {
232+
}
233+
else {
235234
// Regular single-packet payload
236235
return @[payload];
237236
}

0 commit comments

Comments
 (0)