tags:

views:

861

answers:

3

Hi All,

I need a server to send and recieve XMPP messages from Android clients running a multiplayer game I'm writing. I picked XMPP because I don't want to long poll and Sockets can be an issue over the cellular network (Carriers may block them).

I have been looking at OpenFire whilst it sounds amazing, I don't need an admin panel Voice Chat, Chat Rooms etc. it seems very heavyweight and geared towards a chat solution for businesses when all I need is to match players and pass their moves to each other recording a score at the end. Is there a stripped down version of OpenFire so I can just register one component which will service all requests? Regarding adaptation with openfire I can't find a clear example of adding a custom component to perform a similar task.

What I need is a library or existing simple server which I can run and register my custom message listener to. I just need to be able to service any requests coming in and respond appropriately. I'm hoping that I don't have to write the thread management as that issue is common to a typical chat server but I do need to write the code to interpret and respond to the messages sent.

I hope this makes sense, anyone who has written such a piece of server code I would love an example. For those of you that haven't tried it but have an idea how you would start please chip in too! The more detail the better.

Thanks in advance,

Gav

+1  A: 

You should be able to accomplish this with OpenFire (or other XMPP servers) out of the box if they support pubsub. Not sure of the specifics of your needs, but I would think that Personal Eventing Protocol or its superset PubSub should be able to handle your use case. OpenFire does support both these protocols.

If these do not support your use case, then a custom plugin is pretty easy to write.

As for the heavyweight or lightweight, unless you have some specifically small environment for running the server, I doubt it will matter. You simply won't be using many of the features that exist.

I have used XMPP pubsub for clients to communicate actions to each other so users can get live updates of what coworkers in a group are working on.

Robin
Ah so just run an OpenFire server out of the box and on the same machine run a client 'gameserver@<openfiredomain>' and have the players send game messages to that client?That could work, is that what you meant? I do need some centralized information it's not just a case of passing the message from client to client. For example the game board is random and I have to pair the players somehow.
gav
No. I have no idea what you mean by running a client on the the same machine to send messages to. I am assuming the game is the client.
Robin
+3  A: 
Christopher
+1  A: 

If you want a fast, lightweight XMPP server, try Prosody. The other answers are right, however, in that you'll want to look at PubSub first, then writing your own component, before adding functionality directly to the server.

Joe Hildebrand