         }
     }
     
+    func createBinaryMessage() -> String {
+        var array = "45\(self.placeholders)-["
+        array += "\"" + event + "\""
+        if (args? != nil) {
+            if (args is NSDictionary) {
+                array += ","
+                var jsonSendError:NSError?
+                var jsonSend = NSJSONSerialization.dataWithJSONObject(args as NSDictionary,
+                    options: NSJSONWritingOptions(0), error: &jsonSendError)
+                var jsonString = NSString(data: jsonSend!, encoding: NSUTF8StringEncoding)
+                return array + jsonString! + "]"
+            } else {
+                array += ",\"\(args!)\""
+                return array + "]"
+            }
+        } else {
+            return array + "]"
+        }
+    }
+    
     mutating func fillInPlaceHolder(data:NSData) -> Bool {
         func checkDoEvent() -> Bool {
             if (self.placeholders == self.currentPlace) {

        self.io?.open()
    }
    
    // Sends a message
    func emit(event:String, args:Any? = nil) {
        if (!self.connected) {
            return
        }
        
        if let binaryData = args as? NSData {
            self.sendBinaryData(event, data: binaryData)
            return
        }
        
        let frame = SocketMessage(event: event, args: args)
        let str = frame.createMessage()
        
        // println("Sending: \(str)")
        self.io?.send(str)

        }
    }
    
    // Sends ping
    func sendPing() {
        if (!self.connected) {
