Accessing a specific PacketListener

Hello all,

I am still trying to create a web based chat client by using Smack. I initially had a problem with maintaining the XMPPConnection relative to the logged in user but solved that by storing the connection object in a browser session.

Now I am going to use AJAX to return the results from a PacketListener.

I was wondering if there was a way to directly access a connection objects PacketListener?

For example:

Mary logs in and creates a connection called Marys_connection and a PacketListener called Marys_listener is attached to Marys_connection.

Joe logs in and creates a connection called Joes_connection and a PacketListener called Joes_listener is attached to Joes_connection.

They both begin conversing…

So would all Packets that Joe sends out to Mary be attached to Joes_listener?

If so, how would I access Joes_listener directly?

The below listener (got this code from Smack tutor… or this forum) works as advertised afa the System.out output but now I need to access this listener to return this to my app

PacketListener messageListener = new PacketListener()

{

public void processPacket(Packet packet)

{

Message message = (Message)packet;

String from = message.getFrom();

String body = message.getBody();

String to = message.getTo();

System.out.println(from*" SAYS “body” to "*to);//THIS WORKS FINE

}

};

Any ideas?

I know that Smack was not designed to be web-based but I thought I would try.

I may be totally off base as to how the listener should be used so any advice is appreciated…

TIA!!

Any ideas?

TIA!

Message was edited by: gforty