From 1b98af2b116771aeee9235443d10fb22fd443f74 Mon Sep 17 00:00:00 2001 From: Peter Zignego Date: Wed, 15 Jun 2016 22:10:39 -0400 Subject: [PATCH] 05-09 snapshot updates --- SlackKit/Sources/Client.swift | 11 ++++++----- SlackKit/Sources/NetworkInterface.swift | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/SlackKit/Sources/Client.swift b/SlackKit/Sources/Client.swift index e8de985..72fedb6 100644 --- a/SlackKit/Sources/Client.swift +++ b/SlackKit/Sources/Client.swift @@ -23,7 +23,8 @@ import C7 import Jay -import WebSocket +import Venice +import WebSocketClient public class SlackClient { @@ -63,8 +64,8 @@ public class SlackClient { return SlackWebAPI(slackClient: self) } - internal var webSocket: WebSocket.Client? - internal var socket: Socket? + internal var webSocket: Client? + internal var socket: WebSocket? internal let api = NetworkInterface() internal var ping: Double? @@ -88,7 +89,7 @@ public class SlackClient { if let socketURL = response["url"] as? String { do { let uri = try URI(socketURL) - self.webSocket = try WebSocket.Client(uri: uri, onConnect: {(socket) in + self.webSocket = try Client(uri: uri, didConnect: {(socket) in self.setupSocket(socket: socket) if let pingInterval = self.pingInterval { self.pingRTMServerAtInterval(interval: pingInterval) @@ -248,7 +249,7 @@ public class SlackClient { // MARK: - WebSocket - private func setupSocket(socket: Socket) { + private func setupSocket(socket: WebSocket) { socket.onText {(message) in self.websocketDidReceive(message: message) } diff --git a/SlackKit/Sources/NetworkInterface.swift b/SlackKit/Sources/NetworkInterface.swift index 2a1d498..fe743e0 100644 --- a/SlackKit/Sources/NetworkInterface.swift +++ b/SlackKit/Sources/NetworkInterface.swift @@ -24,6 +24,7 @@ import C7 import HTTPSClient import Jay +import WebSocketClient internal struct NetworkInterface { @@ -79,7 +80,6 @@ internal struct NetworkInterface { } let boundaryConstant = randomBoundary() - let contentType:Header = ["multipart/form-data; boundary=" + boundaryConstant] let boundaryStart = "--\(boundaryConstant)\r\n" let boundaryEnd = "--\(boundaryConstant)--\r\n" let contentDispositionString = "Content-Disposition: form-data; name=\"file\"; filename=\"\(parameters!["filename"])\"\r\n" @@ -93,7 +93,7 @@ internal struct NetworkInterface { requestBodyData.append(contentsOf: "\r\n".data.bytes) requestBodyData.append(contentsOf: boundaryEnd.data.bytes) - let header: Headers = ["Content-Type":contentType] + let header: Headers = ["Content-Type":"multipart/form-data; boundary=" + boundaryConstant] do { var response: Response?