try and avoid bad engine states

This commit is contained in:
Erik 2015-03-26 13:15:43 -04:00
parent f008f116a6
commit 2cae405d29
2 changed files with 10 additions and 6 deletions

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Socket.IO-Client-Swift"
s.version = "1.4.0"
s.version = "1.4.2"
s.summary = "Socket.IO-client for Swift"
s.description = <<-DESC
Socket.IO-client for Swift.
@ -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 => 'v1.4.0' }
s.source = { :git => "https://github.com/socketio/socket.io-client-swift.git", :tag => 'v1.4.2' }
s.source_files = "SwiftIO/**/*.swift"
s.requires_arc = true
# s.dependency 'Starscream', '~> 0.9' # currently this repo includes Starscream swift files

View File

@ -118,16 +118,18 @@ public class SocketIOClient: NSObject, SocketEngineClient {
}
super.init()
self.engine = SocketEngine(client: self,
forcePolling: self.forcePolling,
withCookies: self.cookies)
}
public convenience init(socketURL:String, options:NSDictionary?) {
self.init(socketURL: socketURL, opts: options)
}
private func addEngine() {
self.engine = SocketEngine(client: self,
forcePolling: self.forcePolling,
withCookies: self.cookies)
}
/**
Closes the socket. Only reopen the same socket if you know what you're doing.
Will turn off automatic reconnects.
@ -150,6 +152,7 @@ public class SocketIOClient: NSObject, SocketEngineClient {
self._closed = false
}
self.addEngine()
self.engine?.open()
}
@ -165,6 +168,7 @@ public class SocketIOClient: NSObject, SocketEngineClient {
self.params = params
self.paramConnect = true
self.addEngine()
self.engine?.open(opts: params)
}