refactor protocol
This commit is contained in:
parent
1669f2c28f
commit
7777c76dae
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public final class SocketIOClient : NSObject, SocketEngineClient, SocketParsable {
|
public final class SocketIOClient : NSObject, SocketIOClientSpec, SocketEngineClient, SocketParsable {
|
||||||
public let socketURL: URL
|
public let socketURL: URL
|
||||||
|
|
||||||
public private(set) var engine: SocketEngineSpec?
|
public private(set) var engine: SocketEngineSpec?
|
||||||
|
|||||||
@ -27,7 +27,7 @@ protocol SocketParsable : SocketIOClientSpec {
|
|||||||
func parseSocketMessage(_ message: String)
|
func parseSocketMessage(_ message: String)
|
||||||
}
|
}
|
||||||
|
|
||||||
extension SocketParsable {
|
extension SocketParsable where Self: SocketIOClientSpec {
|
||||||
private func isCorrectNamespace(_ nsp: String) -> Bool {
|
private func isCorrectNamespace(_ nsp: String) -> Bool {
|
||||||
return nsp == self.nsp
|
return nsp == self.nsp
|
||||||
}
|
}
|
||||||
@ -107,8 +107,6 @@ extension SocketParsable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var dataArray = message[message.characters.index(reader.currentIndex, offsetBy: 1)..<message.endIndex]
|
var dataArray = message[message.characters.index(reader.currentIndex, offsetBy: 1)..<message.endIndex]
|
||||||
|
|
||||||
if type == .error && !dataArray.hasPrefix("[") && !dataArray.hasSuffix("]") {
|
if type == .error && !dataArray.hasPrefix("[") && !dataArray.hasSuffix("]") {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user