powered by Jive Software

Send message from servlet

Hi All,

Is it possible to send a message from one registered user to another registered user using http servlet like this

http://server-name:9090/openfire/sendMessage?fromUser=user1&toUser=user2&msg=hi

any suggestions…

thanking you in advance

I’m trying to do a similar thing. What I’ve done is create a plugin with a http servlet. I’ve tried using SessionManager.sendMessage to send a message, but Spark doesn’t show the message for some reason, although the debug window shows that it is being received, so I’m trying to send a message from an Admin account, but am still looking for the class in the API that will let me do that.

I ended up using the Smack API in my Openfire plugin to send a message from a certain user to another user.

I have done something similar with a bridge between JMS and XMPP in which JMS messages were sent to specific users. You simply create a Message instance, populate the to and from fields and use the MessageRouter.route(message) to send it.

Not that I am an expert, but using Smack in the server is simply adding an extra layer that serves no purpose since you already have access to the server API.