powered by Jive Software

Custom Stanza or Packet Inspection?

I am in the process of writing a plugin that will essentially parse out information from a client message. In other words a client will send a message with a payload of interest (automated) to the server and the server will take the payload, parse it out and store key aspects of it. I know XMPP can be extended to include custom stanzas, but is it more trouble than it is worth?

Lets say the client message is this:

Nightwalker,Trentemoller,The Last Resort

In this case I am referencing a song title, artist and album it is on. If I wanted to store this information I would just split the contents of the message on the “,” and store the values respectively. That to me would be the parsing method. But could I use a custom stanza (assume the messages being sent are constructed programattically) and have it so the data is already separated in each section for me? So maybe the stanza would be that of a message and nested within the message would be children that would include types of song, artist and album.

The end goal I am shooting for here is to be able to send a message to the server with data I want to store/update in a database. Does it sound like I am going on the right path? Questions and comments are welcome!

I don’t think you should have any issues using XML in your custom stanza and parsing it in your plugin.

Another option though would be to use pubsub or pep from one client to another and then you don’t have to write a plugin at all, just use the server as is. It is designed to carry a payload so you don’t have to create custom anything.