How to build my own iq packets?

Hello, I’m trying to develop a plugin and I need to make my own communication protocol through iq messages.

How can I define my own namespace for an iq and make sure client side knows it too?

I tried to create an iq packet but I can set just the first child element…I don’t know where to start…some code examples would be nice too ^^

All packets sending from OpenFire && Spark uses Smack. To create new packets you have to write new classes extend org.jivesoftware.smack.packet.Packet

I tried writing my own IQ using smack on client side and it works fine.

On server side I got this problem:

i make my IQ this way:

IQ iq = new IQ();

iq.setType(IQ.Type.result);

iq.setChildElement(“RootElement”,“http://mynamespace.org”);

iq.setTo(jid);

iqRouter.route(iq);

now, if, server side, I make

System.out.println(iq.getChildElement.toXML());

I got the right output

how come, client side, I just got

without child element??I’m getting crazyT_T

The client that receives your custom IQ stanza does not know how to parse your child element. You need some sort of provider for this, in Smack. See http://www.igniterealtime.org/builds/smack/docs/latest/documentation/providers.h tml

Thx much, I registered a class as Provider for that kind of IQ and it worked^^

Is it possible to send IQ packets just to a certain room on the server?MultiUserChat class just supports messages…

I need to send an IQ stanza from client to server via smack and get back the response from server it is quite similar to your task. If you have got the solution to the above problem can you plz help me.

Plz share client code with me if u can.