Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
here i am trying to develop a chat app using xmpp and openfire server in windows phone 8.1
here am getting this error-
Exception sending XMPP class

ObjXmppClient.SendChatMessage(Message.Trim(), ReceiverJid); in this lin
e


1. how to test weather message is send or receive?using emulator in windows app or any other way?
2. is there any notification in server when message is received?
3.if it is not the right way to send messages please let me know


my code:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System.Net.XMPP;

namespace WP8Xmpp
{
    public partial class Output : PhoneApplicationPage
    {
        public Output()
        {
            InitializeComponent();
        }


        
           JID jidto = new JID("smitha@taurus");

        public XMPPClient ObjXmppClient { get; set; }
       
        

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (NavigationContext.QueryString.ContainsKey("key"))
            {
                string val = NavigationContext.QueryString["key"];
                if (val.Contains("success"))
                {
                   // lblShowResult.Text = "Successfully Logged in";
                }
                
            }
        }


        private void SendXmppMessage(String Message, JID ReceiverJid)
                 {

                     try
                     {

                        ObjXmppClient = new XMPPClient();

                         ObjXmppClient.SendChatMessage(Message.Trim(), ReceiverJid);

                         ObjXmppClient.OnNewConversationItem += ObjXmppClient_OnNewConversationItem;
                     }

            catch(Exception ex)
                     {



                     }

                  }




        void ObjXmppClient_OnNewConversationItem(RosterItem item, bool bReceived, TextMessage msg)
        {
            if (bReceived)
            {

                txtscreen.Text = txttype.Text;
             
            }
        }
     

      

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            SendXmppMessage(txttype.Text, jidto);
        }
    }
}
Posted
Updated 13-Oct-15 21:23pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900