3.6. Instant Messaging

The fully integrated Instant Messaging System enables the following features in OLAT

Basic install

Prerequisites

  • Instant Messaging Server: Openfire (formerly knows as JiveMessenger/Wildfire) from igniterealtime.org. An Open Source IM server unter the GPL license written in Java. To download the latest server go to: JiveSoftware download Site and download the version that suits your os best.

  • Openfire needs a Java Virtual Machine > = 1.6.x

  • Mysql database. Openfire runs also with other databases (like OLAT does)

  • This installation describes the steps if you run the Openfire on the same machine together with OLAT and share the same database server, but you can run the IM server as well on another machine.

Installation: Go to OLAT_HOME and edit the build.properties file like:

#Instant Messaging properties
instantMessaging.enable=true (enable or disable all instant messaging features)
instantMessaging.server.name=your.jabber.server 
#(you need a own dns name or just localhost for testing)
instantMessaging.generateTestUsers=true 
# (the OLAT test users are generated in OLAT/IM-server with the default passwords also for instant messaging)
instantMessaging.admin.username=admin 
#(these are the default settings of jivemessenger, Change later!)
instantMessaging.admin.password=admin

To reflect these changes run an ant taks (run ant tasks inside the OLAT_HOME folder):

# ant config-all

Now download and install the openfire server and start it (See openfire docu for installation issues). To test your server go the http://[your-instant-messaging-servername]:9090 and log in as admin/admin and you see the admin console. To test the Instant Messaging features open your favorite jabber client like (Exodus, PSI, Kopete, ...) and log in as one of the OLAT Test users automatically created. (user:administrator/pw:olat - user:author/pw:test - user:test/pw:test)

If you are able to chat with each other you are ready to start OLAT together with the IM server. The IM server should run at the time you start OLAT, otherwise you get an error message that you have enabled Instant Messaging but the server is not running.

OLAT uses the admin user account which need to be present on the IM server to talk with Openfire. Versions up to OLAT 6.0.x talked to the IM server over http using the the administration account, emulating the use of the web interface. This was error prone and every change in the openfire web gui lead to errors. Each OLAT release has an associated IM server release it is working with. Since OLAT 6.1.x (available february 2009) a plug in for the IM server must be installed. OLAT creates user accounts and manages groups and group members on the Openfire IM server by sending custom XMPP packets . This XMPP packets are interpreted by a openfire plug-in on the server side an some client code on the OLAT side. You have to install the plug in on the server to enable this. Download the plug in here: http://www.olat.org/downloads/stable/olatUserAndGroupService.jar and use the web console of Openfire to install the plugin.

In the OLAT administration panel

Features

  • Technical overview

    The OLAT Instant Messaging system is build with jabber components. The server (openfire) implements the XMPP protocol and is compatible with most Jabber clients. OLAT connects to the server using the open source client library SMACK from JiveSoftare.

    The SMACK client is used to connect to the server and gets the Roster and manages presence information for the buddies of the connected user. If people like to use one of the fully featured Jabber clients they can use them too. You find the settings in your "Home"->"Settings"->"Instant Messaging". If you use your own jabber client you have to set the resource higher then the SMACK client (priority 0) to route messages to you own client and not to the one integrated in OLAT.

  • OLAT groups synchronizing with the Openfire server.

    OLAT provides a tool for managing personal groups with members called OLAT 'groups' When enabling the Instant Messaging features the information from the groups is used to create and maintain a roster in the instant messaging server. The roster stays always visible in the OLAT user interface and provides a overview of the availablity of the users buddies.

    As the Instant Messaging server is completely separated from OLAT the information is synchronized between the components. We have to explain the mechanism first that you understand how the prozess works. As users who log in using the Shibboleth authenitification mechanism don't have a passwort in OLAT. We create an additional account for each user on the IM server. The credentials consits of the OLAT username which is unique in OLAT and a random generated passwort only used for IM. When a user logs into OLAT for the first time OLAT checks if the user has an IM password. If no, a new accounts gets created on the IM server and the password for this IM account is saved in the o_bs_authentication table with the provider name "INST-MSG". On the IM server you should see the created account as well. There are two cases when you need to synchronize OLAT with the Instant Messaging server.

    case 1: You start olat for the first time with Instant Messaging enabled. Here everything should work automatically if you make sure that the IM server is already running before starting OLAT. In this case OLAT creates the groups and the user accouts of the members of each group in the IM server. If you log in as a user you should see your groups as a roster containing the members.

    case 2: In case of a server crash of the IM server or other problems you have to re-synchronize the data to make sure both databases are synchronized. Shut down Openfire. Log in to the mysql database:

    # mysql -u [database user] -p
    # use openfire;
    # delete from jiveGroupUser;
    # delete from jiveGroupProp;
    # delete from jiveGroup;
    
    # use olat;
    # delete from o_property where name='org.olat.instantMessaging.InstantMessagingModule::issynced';
      

    Next time you start OLAT it synchronizes again the data between OLAT and the IM server.

    If you do not want this feature you can disable it in olat_config.xml in the instant messaging module part.

  • Manually setting the Instant Messaging server properties (setting up the server not with the provided database script)

    The following steps you only have to do if you set up your Instant Messaging database without the provided database script. Go to the admin interface of the server and adjust the following properties.

    - Check the server name: You should use a hostname that gets resolved by the DNS server, otherwise the clients of olat will not be able to connect to the server. Server Settings -> Server Name

    - Registration - Login -> Disable both properties so user cant create accounts themself.

    - Resource Policy -> Choose "Always Kick".

    - Group Chat -> Histroy Settings -> "Show a Specific Number of Messages"

Memory issues

To decrease memory usage start the server with the following virtual machine parameters. "java -jar -Xss256k startup.jar". This will dramatically decrease virtual memory usage on Linux based systems as only 256KB memory is reserverd for each thread stack (default is 512KB).

Openfire Performance Tuning (cache)

Openfire uses caches to run efficiently. Default cache sizes may get to small if you have a lot of users/groups on your system. If you have to much load on your database check and count the queries that only come from Openfire and increase cache size by applying the following sql queries to the Openfire database. In our production system this helped to reduce the number of queries by the factor 10x.

insert into ofProperty (name,propValue) values('cache.group.size','5242880');
insert into ofProperty (name,propValue) values('cache.group.maxLifetime','3600000');

insert into ofProperty (name,propValue) values('cache.username2roster.size','5242880');
insert into ofProperty (name,propValue) values('cache.username2roster.maxLifetime','3600000');

insert into ofProperty (name,propValue) values('cache.userGroup.size','5242880');
insert into ofProperty (name,propValue) values('cache.userGroup.maxLifetime','3600000');

insert into ofProperty (name,propValue) values('cache.userCache.size','2097152');
insert into ofProperty (name,propValue) values('cache.userCache.maxLifetime','3600000');

insert into ofProperty (name,propValue) values('cache.groupMeta.size','2097152');
insert into ofProperty (name,propValue) values('cache.groupMeta.maxLifetime','3600000'); 
      

File handlers

If you have more than 800 concurrent sessions on you OLAT system you should increase file limits on process base. The default file handle limit is normally 1024 per process (per Java VM). As each connection to the server keeps its socket file. When you encounter (or better even before) "Too many open files" Exceptions in the Openfire logfile you should increase it.

#  increasing the max number of filehandles on a Linux box
ulimit -Sn 4096
ulimit -Hn 4096
         

You should do this in the context where the process gets started (init.d file) to make sure every time the service gets restarted it will be set again.