使用 agsxmpp 庫傳送訊息

        public class ConversationManager
        {
            #region ClassMemeber
    
            private XmppClientConnection _xmppClientConnection = null;
    
    
    
     public ConversationManager(XmppClientConnection con)
            {
                _xmppClientConnection = con;
             }

 public void SendMessage(string message, string to, string guid, string type)
        {
            try
            {
                if (_xmppClientConnection != null)
                {
                    Jid jidTo = new Jid(to);
                    agsXMPP.protocol.client.Message mesg = new agsXMPP.protocol.client.Message(jidTo, _ConnectionWrapper.MyJid,
                        agsXMPP.protocol.client.MessageType.chat,
                                      message);

                    mesg.Id = guid;
                    mesg.AddChild(new agsXMPP.protocol.extensions.msgreceipts.Request());//request delievery
                    _xmppClientConnection.Send(mesg);
                }
            }
            catch (Exception ex)
            {
            }
        }

}