This commit is contained in:
parent
eab7311037
commit
922ed4b575
@ -39,6 +39,7 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
|
|||||||
private let parseQueue = dispatch_queue_create("engineParseQueue", DISPATCH_QUEUE_SERIAL)
|
private let parseQueue = dispatch_queue_create("engineParseQueue", DISPATCH_QUEUE_SERIAL)
|
||||||
private let handleQueue = dispatch_queue_create("engineHandleQueue", DISPATCH_QUEUE_SERIAL)
|
private let handleQueue = dispatch_queue_create("engineHandleQueue", DISPATCH_QUEUE_SERIAL)
|
||||||
private let session:NSURLSession!
|
private let session:NSURLSession!
|
||||||
|
|
||||||
private var closed = false
|
private var closed = false
|
||||||
private var _connected = false
|
private var _connected = false
|
||||||
private var fastUpgrade = false
|
private var fastUpgrade = false
|
||||||
@ -540,10 +541,8 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
} else {
|
} else if message.hasPrefix("b4") {
|
||||||
if message.hasPrefix("b4") {
|
|
||||||
// binary in base64 string
|
// binary in base64 string
|
||||||
|
|
||||||
message.removeRange(Range<String.Index>(start: message.startIndex,
|
message.removeRange(Range<String.Index>(start: message.startIndex,
|
||||||
end: advance(message.startIndex, 2)))
|
end: advance(message.startIndex, 2)))
|
||||||
|
|
||||||
@ -558,7 +557,6 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private func probeWebSocket() {
|
private func probeWebSocket() {
|
||||||
if self.websocketConnected {
|
if self.websocketConnected {
|
||||||
|
|||||||
@ -175,6 +175,9 @@ final class SocketPacket: Printable {
|
|||||||
message += jsonString! as String
|
message += jsonString! as String
|
||||||
message += ","
|
message += ","
|
||||||
continue
|
continue
|
||||||
|
} else if arg is NSNull {
|
||||||
|
message += "null,"
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if arg is String {
|
if arg is String {
|
||||||
@ -198,10 +201,8 @@ final class SocketPacket: Printable {
|
|||||||
var newArr = NSMutableArray(array: self.data!)
|
var newArr = NSMutableArray(array: self.data!)
|
||||||
|
|
||||||
for i in 0..<self.data!.count {
|
for i in 0..<self.data!.count {
|
||||||
if let str = self.data?[i] as? String {
|
if let str = self.data?[i] as? String, num = str["~~(\\d)"].groups() {
|
||||||
if let num = str["~~(\\d)"].groups() {
|
|
||||||
newArr[i] = self.binary[num[1].toInt()!]
|
newArr[i] = self.binary[num[1].toInt()!]
|
||||||
}
|
|
||||||
} else if self.data?[i] is NSDictionary || self.data?[i] is NSArray {
|
} else if self.data?[i] is NSDictionary || self.data?[i] is NSArray {
|
||||||
newArr[i] = self._fillInPlaceholders(self.data![i])
|
newArr[i] = self._fillInPlaceholders(self.data![i])
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user