refactor protocol

This commit is contained in:
Erik 2017-05-01 18:43:46 -04:00
parent 1669f2c28f
commit 7777c76dae
No known key found for this signature in database
GPG Key ID: 4930B7C5FBC1A69D
2 changed files with 2 additions and 4 deletions

View File

@ -24,7 +24,7 @@
import Foundation
public final class SocketIOClient : NSObject, SocketEngineClient, SocketParsable {
public final class SocketIOClient : NSObject, SocketIOClientSpec, SocketEngineClient, SocketParsable {
public let socketURL: URL
public private(set) var engine: SocketEngineSpec?

View File

@ -27,7 +27,7 @@ protocol SocketParsable : SocketIOClientSpec {
func parseSocketMessage(_ message: String)
}
extension SocketParsable {
extension SocketParsable where Self: SocketIOClientSpec {
private func isCorrectNamespace(_ nsp: String) -> Bool {
return nsp == self.nsp
}
@ -107,8 +107,6 @@ extension SocketParsable {
}
}
var dataArray = message[message.characters.index(reader.currentIndex, offsetBy: 1)..<message.endIndex]
if type == .error && !dataArray.hasPrefix("[") && !dataArray.hasSuffix("]") {