             }
         }
         
-        if arr[i + 1] == "/" {
+        if messageCharacters[i + 1] == "/" {
             nsp = ""
             
-            while ++i < arr.count {
-                let c = arr[i]
+            while ++i < messageCharacters.count {
+                let c = messageCharacters[i]
                 
                 if c == "," {
                     break

import Foundation

class SocketParser {
    private static func isCorrectNamespace(nsp: String, _ socket: SocketIOClient) -> Bool {
        return nsp == socket.nsp
    }

    
    // Translation of socket.io-client#decodeString
    static func parseString(str: String) -> SocketPacket? {
        let messageCharacters = Array(str.characters)
        guard let type = SocketPacket.PacketType(str: String(messageCharacters[0])) else {
            NSLog("Error parsing \(str)")
            return nil}
        
        if messageCharacters.count == 1 {
            return SocketPacket(type: type, nsp: "/")
        }
        
