         let msg = XMPPMessage(type: "chat", to: senderJID)
         
         msg?.addBody(message)
+        self.xmppStream.addDelegate(self, delegateQueue: DispatchQueue.main)
+        
         self.xmppStream.send(msg)
+        
         
     }
     

        let presence = XMPPPresence(type: "unavailable")
        self.xmppStream.send(presence)
    }

    
    public func sendMessage(message:String, to:String) {
        let message = "Yo!"

        print("Stream: Connected")
        try! stream.authenticate(withPassword: self.password)
    }
    public func xmppStreamDidDisconnect(_ sender: XMPPStream!, withError error: Error!) {
        print("Stream: DisCOnnected")
        
    }
    
    public func xmppStreamDidAuthenticate(_ sender: XMPPStream!) {
        print("Stream: Authenticated")
        goOnline()
        self.xmppDelegate?.xmppConnectionState(status: true)
        
    }
    
    
