code style

This commit is contained in:
Erik 2017-05-20 08:37:54 -04:00
parent 4abd2ab671
commit 46a129072f
No known key found for this signature in database
GPG Key ID: 4930B7C5FBC1A69D
2 changed files with 13 additions and 11 deletions

View File

@ -643,17 +643,19 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
return return
} }
if websocket { guard websocket else {
connected = false
websocket = false
if let reason = error?.localizedDescription {
didError(reason: reason)
} else {
client?.engineDidClose(reason: "Socket Disconnected")
}
} else {
flushProbeWait() flushProbeWait()
return
}
connected = false
websocket = false
if let reason = error?.localizedDescription {
didError(reason: reason)
} else {
client?.engineDidClose(reason: "Socket Disconnected")
} }
} }
} }

View File

@ -237,7 +237,7 @@ open class SocketIOClient : NSObject, SocketIOClientSpec, SocketEngineClient, So
/// - parameter items: The items to send with this event. May be left out. /// - parameter items: The items to send with this event. May be left out.
open func emit(_ event: String, _ items: SocketData...) { open func emit(_ event: String, _ items: SocketData...) {
do { do {
emit(event, with: try items.map({ try $0.socketRepresentation() })) try emit(event, with: items.map({ try $0.socketRepresentation() }))
} catch let err { } catch let err {
DefaultSocketLogger.Logger.error("Error creating socketRepresentation for emit: \(event), \(items)", DefaultSocketLogger.Logger.error("Error creating socketRepresentation for emit: \(event), \(items)",
type: logType) type: logType)