Skip to content

Commit

Permalink
Fix for first polling messages with unicode
Browse files Browse the repository at this point in the history
  • Loading branch information
nuclearace committed Mar 27, 2015
1 parent 81d58fb commit 57731be
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions SwiftIO/SocketEngine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ public class SocketEngine: NSObject, WebSocketDelegate {
if msg.length != 0 {
// Be sure to capture the value of the msg
dispatch_async(self.handleQueue) {[weak self, msg] in
self?.parseEngineMessage(msg)
self?.parseEngineMessage(msg, fromPolling: true)
return
}
}
Expand All @@ -403,9 +403,9 @@ public class SocketEngine: NSObject, WebSocketDelegate {
}
}

private func parseEngineMessage(var message:String) {
private func parseEngineMessage(var message:String, fromPolling:Bool) {
// NSLog("Engine got message: \(message)")
if self.polling {
if fromPolling {
fixDoubleUTF8(&message)
}

Expand Down Expand Up @@ -623,7 +623,7 @@ public class SocketEngine: NSObject, WebSocketDelegate {
}

public func websocketDidReceiveMessage(socket:WebSocket, text:String) {
self.parseEngineMessage(text)
self.parseEngineMessage(text, fromPolling: false)
}

public func websocketDidReceiveData(socket:WebSocket, data:NSData) {
Expand Down

0 comments on commit 57731be

Please sign in to comment.