Skip to content
This repository has been archived by the owner on Dec 2, 2022. It is now read-only.

Commit

Permalink
05-09 snapshot updates
Browse files Browse the repository at this point in the history
  • Loading branch information
pvzig committed Jun 16, 2016
1 parent 750604a commit 1b98af2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions SlackKit/Sources/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@

import C7
import Jay
import WebSocket
import Venice
import WebSocketClient

public class SlackClient {

Expand Down Expand Up @@ -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?
Expand All @@ -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)
Expand Down Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions SlackKit/Sources/NetworkInterface.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import C7
import HTTPSClient
import Jay
import WebSocketClient

internal struct NetworkInterface {

Expand Down Expand Up @@ -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"
Expand All @@ -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?
Expand Down

0 comments on commit 1b98af2

Please sign in to comment.