phpxmppxmpphp

JAXL XMPP Daemon to send and recieve messages


I have written a JAXL daemon in PHP (Debian 6.0) which sits and listens for messages coming in and then process the incoming message by passing the payload to an API. (listens for incoming messages on user1@server)

The trouble I am having is then sending a message back to the user. The way I have done it now is I start another XMPP daemon, send the message, then shutdown the daemon. The trouble with this is that it is starting another daemon with the JID user1@server to send to user2@server. When I shutdown JAXL it also shuts down the 'listening' daemon.

I considered starting the listening daemon again when I send the message but that takes too long to start (1-2 seconds) and my app can't really afford that wait time.

Does anyone have any ideas how I could solve this, perhaps by using the listening daemon to send messages as well?


Solution

  • Just for anyone who is interested in this, I ended up editing JAXL to listen on a UDP socket while the daemon is running, and if data is recieved on that UDP socket is then uses $jaxl->sendMessage(...) and send a message. I then wrote a simple function which sends data to this UDP socket whenever I want to send a message.