still trying

This commit is contained in:
Erik Little 2017-09-17 10:59:27 -04:00
parent 53289dc092
commit bcaf7ba62d
No known key found for this signature in database
GPG Key ID: 4930B7C5FBC1A69D

View File

@ -106,7 +106,7 @@ extension SocketEngineWebsocket {
hostname: url.host ?? "localhost",
port: Port(url.port ?? 80))
let stream: ClientStream = secure ? try TLS.InternetSocket(socket, TLS.Context(.client)) : socket
try WebSocket.background(to: url, using: stream) {[weak self] ws in
try WebSocket.background(to: urlWebSocketWithSid.absoluteString, using: stream) {[weak self] ws in
guard let this = self else { return }
this.ws = ws
@ -172,6 +172,14 @@ extension WebSocket {
return state == .open
}
func disconnect() {
do {
try close()
} catch {
DefaultSocketLogger.Logger.error("Error closing ws", type: "SocketEngineWebsocket", args: string)
}
}
func write(string: String) {
do {
try send(string)