This commit is contained in:
Erik 2015-03-16 13:24:25 -04:00
parent fea16879e1
commit 44e2781076
2 changed files with 7 additions and 12 deletions

View File

@ -179,7 +179,7 @@ public class SocketEngine: NSObject, WebSocketDelegate {
// println(data) // println(data)
if var str = NSString(data: data, encoding: NSUTF8StringEncoding) as? String { if let str = NSString(data: data, encoding: NSUTF8StringEncoding) as? String {
dispatch_async(self!.parseQueue) {callback(str)} dispatch_async(self!.parseQueue) {callback(str)}
} }

View File

@ -217,20 +217,16 @@ class SocketParser {
return return
} }
/** /**
Begin check for message Begin check for message
**/ **/
let messageGroups = stringMessage["(\\d*)\\/?(\\w*)?,?(\\d*)?\\[\"(.*?)\",?(.*?)?\\]$"].groups() let messageGroups = stringMessage["(\\d*)\\/?(\\w*)?,?(\\d*)?\\[\"(.*?)\",?(.*?)?\\]$",
NSRegularExpressionOptions.DotMatchesLineSeparators].groups()
if messageGroups == nil { if messageGroups == nil {
NSLog("Error in groups") NSLog("Error in groups")
return return
} }
// let messageGroups = SwiftRegex(target: stringMessage as NSString,
// pattern: "(\\d*)\\/?(\\w*)?,?(\\d*)?\\[\"(.*?)\",?(.*?)?\\]$",
// options: NSRegularExpressionOptions.DotMatchesLineSeparators).groups()
if messageGroups![1].hasPrefix("2") { if messageGroups![1].hasPrefix("2") {
var mesNum = messageGroups![1] var mesNum = messageGroups![1]
var ackNum:String var ackNum:String
@ -343,10 +339,8 @@ class SocketParser {
/** /**
Begin check for binary placeholders Begin check for binary placeholders
**/ **/
let binaryGroup = message["^(\\d*)-\\/?(\\w*)?,?(\\d*)?\\[(\".*?\")?,?(.*)?\\]$"].groups() let binaryGroup = message["^(\\d*)-\\/?(\\w*)?,?(\\d*)?\\[(\".*?\")?,?(.*)?\\]$",
// let binaryGroup = SwiftRegex(target: message, NSRegularExpressionOptions.DotMatchesLineSeparators].groups()
// pattern: "^(\\d*)-\\/?(\\w*)?,?(\\d*)?\\[(\".*?\")?,?(.*)?\\]$",
// options: NSRegularExpressionOptions.DotMatchesLineSeparators).groups()
if binaryGroup == nil { if binaryGroup == nil {
return return
@ -359,6 +353,7 @@ class SocketParser {
var mutMessageObject:String var mutMessageObject:String
var namespace:String? var namespace:String?
var numberOfPlaceholders:String var numberOfPlaceholders:String
let messageType = binaryGroup![1] let messageType = binaryGroup![1]
namespace = binaryGroup![2] namespace = binaryGroup![2]
@ -422,4 +417,4 @@ class SocketParser {
End check for binary placeholders End check for binary placeholders
**/ **/
} }
} }