         sendFrame(command: StompCommands.commandSend, header: headersToSend, body: message as AnyObject)
     }
     
+    public func isConnected() -> Bool{
+        return connection
+    }
+    
     public func subscribe(destination: String) {
+        connection = true
         subscribeToDestination(destination: destination, ackMode: .AutoMode)
     }
     

    public func openSocketWithURLRequest(request: NSURLRequest, delegate: StompClientLibDelegate, connectionHeaders: [String: String]?) {
        self.connectionHeaders = connectionHeaders
        openSocketWithURLRequest(request: request, delegate: delegate)
    }
    
    private func openSocket() {

    }
    
    public func unsubscribe(destination: String) {
        connection = false
        var headerToSend = [String: String]()
        headerToSend[StompCommands.commandHeaderDestinationId] = destination
        sendFrame(command: StompCommands.commandUnsubscribe, header: headerToSend, body: nil)
