[SLService] public expose service
This commit is contained in:
parent
8e9310045d
commit
001065cd2b
|
@ -16,7 +16,7 @@ public protocol SLClient {
|
|||
}
|
||||
|
||||
extension SLClient {
|
||||
static func receivedData(_ message: Data, from: WebSocketConnection) -> Bool { return false }
|
||||
static func sendMessage(_ message: SLMessage, from client: String) { }
|
||||
static func statusMessage(_ command: SLMessageCommand, from client: String) -> [String]? { return nil }
|
||||
public static func receivedData(_ message: Data, from: WebSocketConnection) -> Bool { return false }
|
||||
public static func sendMessage(_ message: SLMessage, from client: String) { }
|
||||
public static func statusMessage(_ command: SLMessageCommand, from client: String) -> [String]? { return nil }
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@ import KituraWebSocket
|
|||
public class SLService<T: SLClient>: WebSocketService {
|
||||
private var connection: SLConnections = SLConnections()
|
||||
|
||||
public init() {}
|
||||
|
||||
public func connected(connection: WebSocketConnection) {
|
||||
guard let clientId = connection.request.urlURL.query else {
|
||||
inconsonantClient(from: connection, description: "Missing client id")
|
||||
|
@ -44,7 +46,7 @@ public class SLService<T: SLClient>: WebSocketService {
|
|||
} catch SLMessageError.unsupportedType {
|
||||
inconsonantClient(from: from, description: "Unexpected Data")
|
||||
} catch SLMessageError.notAcceptable {
|
||||
inconsonantClient(from: from, description: "Corrupted Data")
|
||||
inconsonantClient(from: from, description: "Corrupted Data")
|
||||
} catch let error {
|
||||
inconsonantClient(from: from, description: "Something went wrong, error: \(error)")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue