Table of Contents
For the purposes of this example we use the ejabberd XMPP server. This is available on all BigWorld supported distributions using package management, however if necessary the official website can be found at:
http://www.process-one.net/en/ejabberd
To install ejabberd under CentOS or Red Hat Enterprise simply perform the following step as the root user:
# yum install ejabberd
Note
Red Hat Enterprise and CentOS users will need to enable the Extra Packages for Enterprise Linux (EPEL) package repository to gain access to this.
The IM chat integration example needs to know how to connect to the
newly installed Jabber server. The script code reads its configuration
from fantasydemo/res/server/config/xmpp.xml
. In this
file you will need to specify the details of the XMPP server (i.e.
hostname and port) as well as a resource name. The resource name is a
unique identifier that specifies to the server where a user is logging in
from when a connection is made. The default resource name is
"FantasyDemo", however this can be altered to your needs as
required.
In this file also ensure that the example has been enabled with the corresponding XML tag.
<root> <enabled> true </enabled> <!-- XMPP Chat example --> <xmppServer> <host> ejabber_server.domain.com </host> <port> 5222 </port> <resourceName> FantasyDemo </resourceName> </xmppServer> </root>
Most package installations of ejabberd will place the configuration
file into /etc/ejabberd/ejabberd.cfg
. When discussing
the ejabberd config file, this is the file that should be
referenced.
Note
When modifying or adding entries to the configuration file, the entries are terminated with a full stop '.'.
The ejabberd server services a domain of logins. For example your environment may contain both www.rpg-game.com as well as www.rts-game.com. Each gaming environment could contain a unique user called 'tony', so we need to tell the ejabberd server that it has to service both these domains.
By default most installations will have a working configuration for localhost, however we will extend this to also support a new servicing domain so other users in the office can login to the server and interact with the game clients. In order to do this we simply use the fully qualified host and domain name of the machine the ejabberd server has been installed on. For example, while testing during the writing of this installation document the ejabberd server was installed onto a host called bw13, so the fully domain being serviced would be bw13.bigworldtech.com. In the ejabberd config file edit the hostname line to look similar to the following, replacing the bw13 domain with your own hostname and domain name.
{hosts, ["localhost", "bw13.bigworldtech.com"]}.
By default the ejabberd server will limit the number of account registrations that are allowed to occur from the same IP address in order to stop the server being abused. As the ejabberd server will be running in an isolated environment where account creations can happen frequently from the same IP address (i.e. the same BaseApp registering multiple new accounts at once), we will disable this limitation. To do so, add the following entry to the ejabberd configuration file:
{registration_timeout, infinity}.