Install PunJab XMPP HTTP/HTTPS client interface

Install PunJab XMPP HTTP/HTTPS client interface

What is Punjab XMPP HTTP Client?

Punjab is a HTTP/HTTPS jabber client interface. It is a BOSH connection manager that allows persistent client connections to a XMPP server. It uses some clever parallel connections to handle input and output streams, so there is very little latency when sending and receiving messages & use very less hardware resources. Its free software so we can redistribute or modify it under the term of the GNU.

By default is support http connection on 5280 port but it’s already used by XMPP Ejabberd web interface so you have to change its port e.g I assume 5281.

 

Let’s take installation part: —

Prerequisite: — Punjab is written in python so you have to install python packages.

root@chat1:~# apt-get install python python-twisted

Now Download Punjab XMPP package from github.com

https://github.com/twonds/punjab

Now unpack it under /opt dir and & open its main configuration file Punjab.tac & make change default port 5280 to 5281.

root@chat1:~# cd /opt
root@chat1:/opt#
root@chat1:/opt# unzip punjab-master.zip

root@srvchat1:/opt/punjab-master# vim punjab.tac
internet.TCPServer(5281, site).setServiceParent(application)

Now Install Punjab by below command.

root@chat1:/opt/punjab-master# python setup.py install
root@chat1:/opt/punjab-master# twistd -y punjab.tac

Check is it working?

1)       Check by netstat command.

root@hat1:opt/punjab-master#  netstat -tulp |grep 5281
tcp 0 0 *:5281 *:* LISTEN 23096/python
root@srvchat1:~/punjab-master#

2)       Check by web interface 

Punjab XMPP HTTP Client

 

 

 

 

 

 

{#moods_dlg.WellDone}

 

Punjab XMPP Run On HTTPS:–

Punjab XMPP Client  is also support secure connection on https.

Open  main configuration file Punjab.tac & add some addition line  of SSL  Configuration.

 

root@chat1:/opt/punjab-master#

# punjab tac file
# tac documentation is at the following URL:
# http://twistedmatrix.com/documents/current/core/howto/application.html
from twisted.web import server, resource, static
from twisted.application import service, internet

from twisted.internet import reactor, ssl #----->add this line for enable ssl module

from punjab.httpb import Httpb, HttpbService

root = static.File("./html")

# uncomment only one of the bosh lines, use_raw does no xml
# parsing/serialization but is potentially less reliable
#bosh = HttpbService(1, use_raw=True)
bosh = HttpbService(1)

# You can limit servers with a whitelist.
# The whitelist is a list of strings to match domain names.
# bosh.white_list = ['jabber.org', 'thetofu.com']
# or a black list
# bosh.block_list = ['jabber.org', '.thetofu.com']

root.putChild('http-bind', resource.IResource(bosh))


site = server.Site(root)

application = service.Application("punjab")
internet.TCPServer(5281, site).setServiceParent(application)


# original tac file from punjab.tac

#Add below lines at the bottom
sslContext = ssl.DefaultOpenSSLContextFactory(
'/opt/ejabberd-2.1.13/conf/server.pem', #server.pem must contain ssl .key & .crt file
'/opt/ejabberd-2.1.13/conf/server.pem', #server.pem must contain ssl .key & .crt file

)
reactor.listenSSL(
5285, # defile port for ssl punjab xmpp clinet
site, # the site object from punjab.tac
contextFactory = sslContext,
)

Stop & Start Punjab Services.

root@chat1:/opt/punjab-master# twistd -n punjab.tac

root@chat1:/opt/punjab-master# twistd -y punjab.tac

Check is it working?

1)       Check by netstat command.

root@chat1:opt/punjab-master#  netstat -tulp |grep 5285
tcp 0 0 *:5285 *:* LISTEN 23099/python
root@chat1:/opt/punjab-master#

2)       Check by web interface .

Punjab XMPP HTTPS Client

 

 

 

 

 

 

Enjoy {#moods_dlg.WellDone}

Leave a Reply

Time limit is exhausted. Please reload the CAPTCHA.