Subject: Unable to Request Rosters
Hi,
I am creating a Chat Application (Client and Server) using MatriX SDK.
I have create a Server wich will handle the Request From Client , i am facing an issue ,
when it try to Request Rosters using Asynchronous Iq Filter . it seems that i am not able to get the proper responce form my server.
Or i did any thin wrong in calling.
Server Code.
XML Output
I am creating a Chat Application (Client and Server) using MatriX SDK.
I have create a Server wich will handle the Request From Client , i am facing an issue ,
when it try to Request Rosters using Asynchronous Iq Filter . it seems that i am not able to get the proper responce form my server.
Or i did any thin wrong in calling.
private void button2_Click(object sender, System.EventArgs e)
{
xmppClient.IqFilter.SendIq(ri, RosterResponse);
}
private void RosterResponse(object sender, IqEventArgs e)
{
var iq = e.Iq;
if(iq.Type == IqType.result)
{
//var r = Iq.Query as Matrix.Xmpp.Roster.Roster;
//foreach(RosterItem ri in r.GetRoster())
// OnRosterItem(this, new RosterEventArgs(ri));
}
else if(iq.Type == IqType.error)
{
// process errors here
}
}
Server Code.
void streamParser_OnStreamElement(object sender, StanzaEventArgs e)
{
Console.WriteLine("OnStreamElement: " + e.ToString());
DisplayData(e.Stanza.ToString());
if(e.Stanza.Name.LocalName == "Presence".ToLower())
{
// route presences here and handle all subscription stuff
}
else if(e.GetType() == typeof(Message))
{
// route the messages here
ProcessMessages(e.Stanza as Message);
}
else if(e.Stanza.Name.LocalName == "Iq".ToLower())
{
////ProcessIQ(e.Stanza as Iq);
System.Collections.Generic.List<RosterItem> items = new System.Collections.Generic.List<RosterItem>();
items.Add(new RosterItem()
{
Jid = "manish.roy@quipment.in",
Name = "Manish Roy",
Subscription = Subscription.both,
});
items.Add(new RosterItem()
{
Jid = "rajesh.dabhi@quipment.in",
Name = "Rajesh Dabhi",
Subscription = Subscription.both
});
items.Add(new RosterItem()
{
Jid = "chaitanya.doshi@quipment.in",
Name = "Chaitanya Doshi",
Subscription = Subscription.both
});
Iq iq = new Iq();
iq.Id = e.Stanza.FirstAttribute.Value;
iq.Type = IqType.result;
iq.To = "manish.roy@quipment.nl";
iq.Add(items);
Send(iq.ToString());
}
}
XML Output
SEND:
<iq id="MX_1" type="get" xmlns="jabber:client">
<query xmlns="jabber:iq:roster" />
</iq>
RECV:
<iq id="MX_1" type="result" to="manish.roy@quipment.nl" xmlns="jabber:component:accept">
<item jid="manish.roy@quipment.in" name="Manish Roy" subscription="both" xmlns="jabber:iq:roster" />
<item jid="rajesh.dabhi@quipment.in" name="Rajesh Dabhi" subscription="both" xmlns="jabber:iq:roster" />
<item jid="chaitanya.doshi@quipment.in" name="Chaitanya Doshi" subscription="both" xmlns="jabber:iq:roster" />
</iq>
roymanish1982
Show profile
Link to this post