« Posts tagged ejabberd

Using Pubsub service of Ejabberd for live data

The concept of real-time Web became more popular. Real-time information to be shared between sites. I made some models and will introduce it soon.

Primary language : Erlang
Protocol : XMPP over BOSH
XMPP server: Ejabberd (had Pubsub service)
Server database: CouchDB or Riak
Web host: Webmachine + Mochiweb behind Ngnix

Beta version at : http://stocktm.com

Testing new XEPs added on the Ejabberd 2.1.0 final version

+ XEP Support :

  • Added XEP-0059 Result Set Management (for listing rooms)
  • Added XEP-0082 Date Time
  • Added XEP-0085 Chat State Notifications
  • Added XEP-0157 Contact Addresses for XMPP Services
  • Added XEP-0158 CAPTCHA Forms (in MUC rooms)
  • Added STUN server, for XEP-0176: Jingle ICE-UDP Transport Method (skipped this XEP because my system to bad :D )
  • Added XEP-0199 XMPP Ping
  • Added XEP-0202 Entity Time
  • Added XEP-0203 Delayed Delivery
  • Added XEP-0227 Portable Import/Export Format for XMPP-IM Servers
  • Added XEP-0237 Roster Versioning

+ Test enviroment :

  • Server : CPU E2200 @ 2.20GHz x86_64bit 4GB Ram
  • OS : Ubuntu server distro with Linux kernel : 2.6.28-13-generic with GNOME desktop env.
  • Erlang R13B (erts-5.7.1) async-thread:1 kernel-poll:true
  • Ejabberd 2.1.0 final version (virtual host : cuonglb-desktop with one node : ejabberd@localhost)
  • Create two users for this test : user_a@cuonglb-desktop and user_b@cuonglb-desktop
  • PSI 0.12 with XML Console
  • Python 2.5.4 r254:67916 [GCC 4.3.3]
  • Twisted 8.2.0

We are starting with XEP-0199 XMPP Ping:
Open config file of ejabberd at ./conf/ejabberd.cfg and add mod_ping in modules terms (no options):

Erlang
    {modules,
     [
      {mod_adhoc,    []},
      ...
      {mod_ping,    []},
      ...
    ]
    }

Ok, now restart ejabberd server : ./bin/ejabberdctrl restart
Start PSI -> General -> Account setup -> Add account of user a : user_a@cuonglb-desktop and set status is online.
Start PSI:XML Console -> right click on the account user_a@cuonglb-desktop from accounts list and click XML Console.
In XML Console dialog click Enable and click XML Input … button and input xml iq stanza bellow :

Client-to-Server ping

XML
<iq from="cuonglb@cuonglb-desktop/cuonglb-desktop" type="get" to="cuonglb-desktop">
  <ping xmlns='urn:xmpp:ping'/>
</iq>

See on XML Console :

XEP-0157: Contact Addresses for XMPP Services

Queries server with iq stanza :

XML
<iq from='cuonglb@jabber.org/cuongle-lappy'
    to='jabber.org'
    id='disco1'
    type='get'>
  <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>

My server communicates info

XML
<iq from="jabber.org" type="result" to="cuonglb@jabber.org/cuongle-lappy" id="disco1" >
<query xmlns="http://jabber.org/protocol/disco#info">
<identity category="server" type="im" name="ejabberd" />
<feature var="http://ejabberd.jabberstudio.org/protocol/configure" />
<feature var="http://jabber.org/protocol/commands" />
<feature var="http://jabber.org/protocol/disco#info" />
<feature var="http://jabber.org/protocol/disco#items" />
<feature var="http://jabber.org/protocol/disco#publish" />
<feature var="iq" />
<feature var="jabber:iq:last" />
<feature var="jabber:iq:register" />
<feature var="jabber:iq:time" />
<feature var="jabber:iq:version" />
<feature var="presence" />
<feature var="presence-invisible" />
<feature var="vcard-temp" />
<feature var="http://jabber.org/protocol/commands" />
</query>
</iq>