Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Super simple XMPP server or advice for a simple custom Openfire component

Tags:

java

xmpp

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

like image 914
gav Avatar asked Mar 10 '10 21:03

gav


People also ask

What is an XMPP server?

XMPP is the Extensible Messaging and Presence Protocol, a set of open technologies for instant messaging, presence, multi-party chat, voice and video calls, collaboration, lightweight middleware, content syndication, and generalized routing of XML data.

What does XMPP stand for?

Extensible Messaging and Presence Protocol (XMPP) is an open XML technology for real-time communication, which powers a wide range of applications including instant messaging, presence and collaboration.


2 Answers

You can use almost any XMPP server; I know that Openfire will work, or I've also recently used Prosody which is very lightweight and easy to install (on Linux).

What you want is a standalone component that communicates with your XMPP server (and thereby can reach your users) using the XMPP component protocol. That's where the game intelligence lies.

See my previous answer to a very similar question for more detail:
XMPP C# Interaction

Another great place to look for information is anything written by Jack Moffitt, who created chesspark.com (since purchased by chess.com so not available) — a site that matched chess users and controlled games using XMPP.

See this blog post as a start:
http://metajack.im/2008/11/21/chesspark_design_details_part_1_why_xmpp/

like image 182
Christopher Orr Avatar answered Oct 13 '22 09:10

Christopher Orr


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.

like image 41
Joe Hildebrand Avatar answered Oct 13 '22 09:10

Joe Hildebrand