Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c049f62028 | ||
|
|
88c139ed0c | ||
|
|
fdfd4dbc4d | ||
|
|
9e0726d61f |
No files matched your search
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "Socket.IO-Client-Swift"
|
||||
s.version = "2.2.2"
|
||||
s.version = "2.2.3"
|
||||
s.summary = "Socket.IO-client for iOS and OS X"
|
||||
s.description = <<-DESC
|
||||
Socket.IO-client for iOS and OS X.
|
||||
@@ -12,7 +12,7 @@ Pod::Spec.new do |s|
|
||||
s.author = { "Erik" => "nuclear.ace@gmail.com" }
|
||||
s.ios.deployment_target = '8.0'
|
||||
s.osx.deployment_target = '10.10'
|
||||
s.source = { :git => "https://github.com/socketio/socket.io-client-swift.git", :tag => 'v2.2.2' }
|
||||
s.source = { :git => "https://github.com/socketio/socket.io-client-swift.git", :tag => 'v2.2.3' }
|
||||
s.source_files = "SocketIOClientSwift/**/*.swift"
|
||||
s.requires_arc = true
|
||||
# s.dependency 'Starscream', '~> 0.9' # currently this repo includes Starscream swift files
|
||||
|
||||
@@ -32,4 +32,4 @@ import Foundation
|
||||
self.event = event
|
||||
self.items = items
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -166,7 +166,7 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
|
||||
}
|
||||
|
||||
if params != nil {
|
||||
let allowedCharacterSet = NSCharacterSet(charactersInString: "!*'();:@&=+$,/?%#[]\" ").invertedSet
|
||||
let allowedCharacterSet = NSCharacterSet(charactersInString: "!*'();:@&=+$,/?%#[]\" {}").invertedSet
|
||||
|
||||
for (key, value) in params! {
|
||||
let keyEsc = key.stringByAddingPercentEncodingWithAllowedCharacters(
|
||||
@@ -493,15 +493,11 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
|
||||
}
|
||||
} else if type == PacketType.NOOP {
|
||||
self.doPoll()
|
||||
return
|
||||
} else if type == PacketType.PONG {
|
||||
// We should upgrade
|
||||
if message == "3probe" {
|
||||
self.upgradeTransport()
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
} else if type == PacketType.OPEN {
|
||||
var err:NSError?
|
||||
|
||||
@@ -531,8 +527,6 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
|
||||
if !self.forceWebsockets {
|
||||
self.doPoll()
|
||||
}
|
||||
|
||||
return
|
||||
} else if type == PacketType.CLOSE {
|
||||
if self.client == nil {
|
||||
return
|
||||
@@ -541,8 +535,6 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
|
||||
if self.polling {
|
||||
self.client!.engineDidClose("Disconnect")
|
||||
}
|
||||
|
||||
return
|
||||
} else if message.hasPrefix("b4") {
|
||||
// binary in base64 string
|
||||
message.removeRange(Range<String.Index>(start: message.startIndex,
|
||||
|
||||
@@ -35,4 +35,4 @@ import Foundation
|
||||
func engineDidClose(reason:String)
|
||||
func parseSocketMessage(msg:String)
|
||||
func parseBinaryData(data:NSData)
|
||||
}
|
||||
}
|
||||
@@ -45,4 +45,4 @@ final class SocketEventHandler {
|
||||
self?.callback?(items, ack != nil ? emitAckCallback(socket!, ack!) : nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -89,40 +89,36 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
|
||||
self.opts = opts
|
||||
|
||||
// Set options
|
||||
if opts != nil {
|
||||
if let sessionDelegate = opts!["sessionDelegate"] as? NSURLSessionDelegate {
|
||||
self.sessionDelegate = sessionDelegate
|
||||
if let sessionDelegate = opts?["sessionDelegate"] as? NSURLSessionDelegate {
|
||||
self.sessionDelegate = sessionDelegate
|
||||
}
|
||||
|
||||
if let log = opts?["log"] as? Bool {
|
||||
self.log = log
|
||||
}
|
||||
|
||||
if var nsp = opts?["nsp"] as? String {
|
||||
if nsp != "/" && nsp.hasPrefix("/") {
|
||||
nsp.removeAtIndex(nsp.startIndex)
|
||||
}
|
||||
|
||||
if let log = opts!["log"] as? Bool {
|
||||
self.log = log
|
||||
}
|
||||
|
||||
if var nsp = opts!["nsp"] as? String {
|
||||
if nsp != "/" && nsp.hasPrefix("/") {
|
||||
nsp.removeAtIndex(nsp.startIndex)
|
||||
}
|
||||
|
||||
self.nsp = nsp
|
||||
}
|
||||
|
||||
if let reconnects = opts!["reconnects"] as? Bool {
|
||||
self.reconnects = reconnects
|
||||
}
|
||||
|
||||
if let reconnectAttempts = opts!["reconnectAttempts"] as? Int {
|
||||
self.reconnectAttempts = reconnectAttempts
|
||||
} else {
|
||||
self.reconnectAttempts = -1
|
||||
}
|
||||
|
||||
if let reconnectWait = opts!["reconnectWait"] as? Int {
|
||||
self.reconnectWait = abs(reconnectWait)
|
||||
}
|
||||
self.nsp = nsp
|
||||
}
|
||||
|
||||
if let reconnects = opts?["reconnects"] as? Bool {
|
||||
self.reconnects = reconnects
|
||||
}
|
||||
|
||||
if let reconnectAttempts = opts?["reconnectAttempts"] as? Int {
|
||||
self.reconnectAttempts = reconnectAttempts
|
||||
} else {
|
||||
self.reconnectAttempts = -1
|
||||
}
|
||||
|
||||
if let reconnectWait = opts?["reconnectWait"] as? Int {
|
||||
self.reconnectWait = abs(reconnectWait)
|
||||
}
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
@@ -499,4 +495,4 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
|
||||
self.connect()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -94,7 +94,6 @@ final class SocketPacket: Printable {
|
||||
|
||||
func createMessageForEvent(event:String) -> String {
|
||||
let message:String
|
||||
var jsonSendError:NSError?
|
||||
|
||||
if self.binary.count == 0 {
|
||||
self.type = PacketType.EVENT
|
||||
@@ -157,7 +156,7 @@ final class SocketPacket: Printable {
|
||||
return self.completeMessage(msg, ack: true)
|
||||
}
|
||||
|
||||
func completeMessage(var message:String, ack:Bool = false) -> String {
|
||||
private func completeMessage(var message:String, ack:Bool = false) -> String {
|
||||
var err:NSError?
|
||||
|
||||
if self.data == nil || self.data!.count == 0 {
|
||||
|
||||
Reference in new issue
Block a user