diff --git a/Source/SocketEngine.swift b/Source/SocketEngine.swift index e06a811..1a4c138 100644 --- a/Source/SocketEngine.swift +++ b/Source/SocketEngine.swift @@ -62,9 +62,6 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe private weak var sessionDelegate: NSURLSessionDelegate? - private typealias Probe = (msg: String, type: SocketEnginePacketType, data: [NSData]) - private typealias ProbeWaitQueue = [Probe] - private let logType = "SocketEngine" private let url: NSURL @@ -74,6 +71,7 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe pongsMissedMax = Int(pingTimeout / (pingInterval ?? 25)) } } + private var pongsMissed = 0 private var pongsMissedMax = 0 private var probeWait = ProbeWaitQueue() diff --git a/Source/SocketPacket.swift b/Source/SocketPacket.swift index a9c0538..e73a2b6 100644 --- a/Source/SocketPacket.swift +++ b/Source/SocketPacket.swift @@ -97,7 +97,7 @@ struct SocketPacket { let jsonSend = try NSJSONSerialization.dataWithJSONObject(data, options: NSJSONWritingOptions(rawValue: 0)) guard let jsonString = String(data: jsonSend, encoding: NSUTF8StringEncoding) else { - return "[]" + return message + "[]" } restOfMessage = jsonString @@ -229,7 +229,7 @@ extension SocketPacket { static func packetFromEmit(items: [AnyObject], id: Int, nsp: String, ack: Bool) -> SocketPacket { let (parsedData, binary) = deconstructData(items) let packet = SocketPacket(type: findType(binary.count, ack: ack), data: parsedData, - id: id, nsp: nsp, placeholders: -1, binary: binary) + id: id, nsp: nsp, binary: binary) return packet } diff --git a/Source/SocketTypes.swift b/Source/SocketTypes.swift index b8840be..7f27c42 100644 --- a/Source/SocketTypes.swift +++ b/Source/SocketTypes.swift @@ -28,6 +28,9 @@ public typealias AckCallback = ([AnyObject]) -> Void public typealias NormalCallback = ([AnyObject], SocketAckEmitter) -> Void public typealias OnAckCallback = (timeoutAfter: UInt64, callback: AckCallback) -> Void +typealias Probe = (msg: String, type: SocketEnginePacketType, data: [NSData]) +typealias ProbeWaitQueue = [Probe] + enum Either { case Left(E) case Right(V)