This commit is contained in:
parent
fea16879e1
commit
44e2781076
@ -179,7 +179,7 @@ public class SocketEngine: NSObject, WebSocketDelegate {
|
||||
|
||||
// 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)}
|
||||
}
|
||||
|
||||
|
||||
@ -217,20 +217,16 @@ class SocketParser {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Begin check for message
|
||||
**/
|
||||
let messageGroups = stringMessage["(\\d*)\\/?(\\w*)?,?(\\d*)?\\[\"(.*?)\",?(.*?)?\\]$"].groups()
|
||||
let messageGroups = stringMessage["(\\d*)\\/?(\\w*)?,?(\\d*)?\\[\"(.*?)\",?(.*?)?\\]$",
|
||||
NSRegularExpressionOptions.DotMatchesLineSeparators].groups()
|
||||
if messageGroups == nil {
|
||||
NSLog("Error in groups")
|
||||
return
|
||||
}
|
||||
|
||||
// let messageGroups = SwiftRegex(target: stringMessage as NSString,
|
||||
// pattern: "(\\d*)\\/?(\\w*)?,?(\\d*)?\\[\"(.*?)\",?(.*?)?\\]$",
|
||||
// options: NSRegularExpressionOptions.DotMatchesLineSeparators).groups()
|
||||
|
||||
if messageGroups![1].hasPrefix("2") {
|
||||
var mesNum = messageGroups![1]
|
||||
var ackNum:String
|
||||
@ -343,10 +339,8 @@ class SocketParser {
|
||||
/**
|
||||
Begin check for binary placeholders
|
||||
**/
|
||||
let binaryGroup = message["^(\\d*)-\\/?(\\w*)?,?(\\d*)?\\[(\".*?\")?,?(.*)?\\]$"].groups()
|
||||
// let binaryGroup = SwiftRegex(target: message,
|
||||
// pattern: "^(\\d*)-\\/?(\\w*)?,?(\\d*)?\\[(\".*?\")?,?(.*)?\\]$",
|
||||
// options: NSRegularExpressionOptions.DotMatchesLineSeparators).groups()
|
||||
let binaryGroup = message["^(\\d*)-\\/?(\\w*)?,?(\\d*)?\\[(\".*?\")?,?(.*)?\\]$",
|
||||
NSRegularExpressionOptions.DotMatchesLineSeparators].groups()
|
||||
|
||||
if binaryGroup == nil {
|
||||
return
|
||||
@ -359,6 +353,7 @@ class SocketParser {
|
||||
var mutMessageObject:String
|
||||
var namespace:String?
|
||||
var numberOfPlaceholders:String
|
||||
|
||||
let messageType = binaryGroup![1]
|
||||
|
||||
namespace = binaryGroup![2]
|
||||
@ -422,4 +417,4 @@ class SocketParser {
|
||||
End check for binary placeholders
|
||||
**/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user