Skip to content

Commit 9eb41ee

Browse files
committed
allow array as connection param
1 parent d0a1437 commit 9eb41ee

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

Source/VPSocketEngine.m

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,22 @@ -(void) createURLs
226226
urlPollingComponent.scheme = @"http";
227227
}
228228

229-
for (NSString *key in _connectParams.allKeys) {
230-
NSString *value = _connectParams[key];
229+
for (id key in _connectParams.allKeys) {
231230
NSString *encodedKey = [key urlEncode];
232-
NSString *encodedValue = [value urlEncode];
233-
[queryString appendFormat:@"&%@=%@", encodedKey, encodedValue];
231+
id value = _connectParams[key];
232+
if([value isKindOfClass:[NSString class]]) {
233+
NSString *encodedValue = [(NSString*)value urlEncode];
234+
[queryString appendFormat:@"&%@=%@", encodedKey, encodedValue];
235+
}
236+
else if([value isKindOfClass:[NSArray class]]){
237+
NSArray *array = value;
238+
for (id item in array) {
239+
if([item isKindOfClass:[NSString class]]) {
240+
NSString *encodedValue = [item urlEncode];
241+
[queryString appendFormat:@"&%@=%@", encodedKey, encodedValue];
242+
}
243+
}
244+
}
234245
}
235246

236247
urlWebSocketComponent.percentEncodedQuery = [NSString stringWithFormat:@"transport=websocket%@",queryString];

VPSocketIO.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "VPSocketIO"
3-
s.version = "1.0.4"
3+
s.version = "1.0.5"
44
s.summary = "Socket.IO client for iOS"
55
s.description = <<-DESC
66
Socket.IO-client for iOS.

0 commit comments

Comments
 (0)