Skip to content

Commit

Permalink
allow array as connection param
Browse files Browse the repository at this point in the history
  • Loading branch information
vasily-popov committed Feb 3, 2018
1 parent d0a1437 commit 9eb41ee
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
19 changes: 15 additions & 4 deletions Source/VPSocketEngine.m
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,22 @@ -(void) createURLs
urlPollingComponent.scheme = @"http";
}

for (NSString *key in _connectParams.allKeys) {
NSString *value = _connectParams[key];
for (id key in _connectParams.allKeys) {
NSString *encodedKey = [key urlEncode];
NSString *encodedValue = [value urlEncode];
[queryString appendFormat:@"&%@=%@", encodedKey, encodedValue];
id value = _connectParams[key];
if([value isKindOfClass:[NSString class]]) {
NSString *encodedValue = [(NSString*)value urlEncode];
[queryString appendFormat:@"&%@=%@", encodedKey, encodedValue];
}
else if([value isKindOfClass:[NSArray class]]){
NSArray *array = value;
for (id item in array) {
if([item isKindOfClass:[NSString class]]) {
NSString *encodedValue = [item urlEncode];
[queryString appendFormat:@"&%@=%@", encodedKey, encodedValue];
}
}
}
}

urlWebSocketComponent.percentEncodedQuery = [NSString stringWithFormat:@"transport=websocket%@",queryString];
Expand Down
2 changes: 1 addition & 1 deletion VPSocketIO.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "VPSocketIO"
s.version = "1.0.4"
s.version = "1.0.5"
s.summary = "Socket.IO client for iOS"
s.description = <<-DESC
Socket.IO-client for iOS.
Expand Down

0 comments on commit 9eb41ee

Please sign in to comment.