       return json
     }
   }
-}+}

      socket?.send(payload)
    }
    
    func leave(message: Phoenix.Message) {
      if let sock = socket {
        sock.leave(topic: topic!, message: message)
      }

    var heartbeatTimer: NSTimer?
    let heartbeatAfterSec = 30
    var messageReference: UInt64 = UInt64.min // 0 (max: 18,446,744,073,709,551,615)
    
    public init(domainAndPort:String, path:String, transport:String, prot:String = "http") {
      self.endPoint = Path.endpointWithProtocol(prot, domainAndPort: domainAndPort, path: path, transport: transport)
      super.init()
