Skip to content

Commit 44e2781

Browse files
committed
1 parent fea1687 commit 44e2781

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

SwiftIO/SocketEngine.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public class SocketEngine: NSObject, WebSocketDelegate {
179179

180180
// println(data)
181181

182-
if var str = NSString(data: data, encoding: NSUTF8StringEncoding) as? String {
182+
if let str = NSString(data: data, encoding: NSUTF8StringEncoding) as? String {
183183
dispatch_async(self!.parseQueue) {callback(str)}
184184
}
185185

SwiftIO/SocketParser.swift

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -217,20 +217,16 @@ class SocketParser {
217217
return
218218
}
219219

220-
221220
/**
222221
Begin check for message
223222
**/
224-
let messageGroups = stringMessage["(\\d*)\\/?(\\w*)?,?(\\d*)?\\[\"(.*?)\",?(.*?)?\\]$"].groups()
223+
let messageGroups = stringMessage["(\\d*)\\/?(\\w*)?,?(\\d*)?\\[\"(.*?)\",?(.*?)?\\]$",
224+
NSRegularExpressionOptions.DotMatchesLineSeparators].groups()
225225
if messageGroups == nil {
226226
NSLog("Error in groups")
227227
return
228228
}
229229

230-
// let messageGroups = SwiftRegex(target: stringMessage as NSString,
231-
// pattern: "(\\d*)\\/?(\\w*)?,?(\\d*)?\\[\"(.*?)\",?(.*?)?\\]$",
232-
// options: NSRegularExpressionOptions.DotMatchesLineSeparators).groups()
233-
234230
if messageGroups![1].hasPrefix("2") {
235231
var mesNum = messageGroups![1]
236232
var ackNum:String
@@ -343,10 +339,8 @@ class SocketParser {
343339
/**
344340
Begin check for binary placeholders
345341
**/
346-
let binaryGroup = message["^(\\d*)-\\/?(\\w*)?,?(\\d*)?\\[(\".*?\")?,?(.*)?\\]$"].groups()
347-
// let binaryGroup = SwiftRegex(target: message,
348-
// pattern: "^(\\d*)-\\/?(\\w*)?,?(\\d*)?\\[(\".*?\")?,?(.*)?\\]$",
349-
// options: NSRegularExpressionOptions.DotMatchesLineSeparators).groups()
342+
let binaryGroup = message["^(\\d*)-\\/?(\\w*)?,?(\\d*)?\\[(\".*?\")?,?(.*)?\\]$",
343+
NSRegularExpressionOptions.DotMatchesLineSeparators].groups()
350344

351345
if binaryGroup == nil {
352346
return
@@ -359,6 +353,7 @@ class SocketParser {
359353
var mutMessageObject:String
360354
var namespace:String?
361355
var numberOfPlaceholders:String
356+
362357
let messageType = binaryGroup![1]
363358

364359
namespace = binaryGroup![2]
@@ -422,4 +417,4 @@ class SocketParser {
422417
End check for binary placeholders
423418
**/
424419
}
425-
}
420+
}

0 commit comments

Comments
 (0)