Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Windows Phone 8 XMPP Send and Receive Message

0.00/5 (No votes)
16 Feb 2015 2  
Send and receive XMPP messages in Windows phone 8

Introduction

This tip tells you about sending and receiving XMPP message in Windows phone 8.

Background

This is continued from my previous article. Please, find the link here.

Using the Code

Sending XMPP message in Windows phone 8 does not require any analysis because it is a method built in with XMPP Client of the DLL.

Below is the syntax required to be followed for sending message.

C#
private void SendXmppMessage(String Message, JId ReceiverJid)
        {
            ObjXmppClient.SendChatMessage(Message.Trim(), ReceiverJid);
        }

But to receive a message from other roster requires handler to initiate the message receiving asynchronously. The handler is OnNewConversationItem.

The syntax is mentioned below:

C#
ObjXmppClient.OnNewConversationItem += ObjXmppClient_OnNewConversationItem;

void ObjXmppClient_OnNewConversationItem(RosterItem item, bool bReceived,TextMessage msg)
        {
            if (bReceived)
            {
                //do your property settings
            }
        }

If bReceived ==true, then message is received from other roster, or else message is sent by you to other roster.

Note: I am working on a sample to send and receive files. I will update it soon.

I hope it will be helpful for those who need it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here