You probably think that I’m joking, but I’m not. You can actually build a jabber/xmpp app in less than 10 minutes if you have a good internet connection, and have already set up your system with “clickable”. If not, be sure to check out my last post about it.
Are you ready to get started? Okay, here we go!
The magic that makes this work is that someone (or rather a group of someones) has already made a javascript xmpp client called convers.js. Head over to their website (https://conversejs.org/) and download it, or more directly, just click here: https://github.com/conversejs/converse.js/archive/v3.3.4.zip
Now jump over to your downloads folder and unzip it, or extract it if you grabbed the tar version. Great job, we are 20% done!
Open up your terminal and start typing:
$ mkdir xmmpapp
$ cd xmmpapp/
$ clickable init
Available app templates:
[1] pure-qml-cmake – Pure QML App (built using CMake)
[2] cmake – C++/QML App (built using CMake)
[3] python-cmake – Python/QML App (built using CMake)
[4] html – HTML App
[5] webapp – Simple Webapp
Choose an app template [1]: 4
Generating new app from template: HTML App
You’ve cloned /home/alaskalinuxuser/.cookiecutters/ut-app-html-template before. Is it okay to delete and re-clone it? [yes]: yes
Cloning into ‘ut-app-html-template’…
remote: Counting objects: 28, done.
remote: Total 28 (delta 0), reused 0 (delta 0), pack-reused 28
Unpacking objects: 100% (28/28), done.
Checking connectivity… done.
title [App Title]: xmppapp
description [A short description of your app]: xmpp app.
app_name [appname]: xmppapp
app_full_name [appname.yourname]: xmppapp.alaskalinuxuser
version [1.0.0]: 1.0.0
maintainer_name [Your FullName]: Alaskalinuxuser
maintainer_email [email@domain.org]:
Select open_source_license:
1 – GNU General Public License v3
2 – MIT license
3 – BSD license
4 – ISC license
5 – Apache Software License 2.0
6 – Not open source
Choose from 1, 2, 3, 4, 5, 6 [1]: 5
Your new app has been generated, go to the app’s directory and run clickable to get started
$
All we did was make a directory, run clickable, and choose to make a html app. Notice that this is not a web-app, which is basically a shortcut to some web site. This app is all on the users phone and just opens up an html file. We are now 40% done!
Open up your file manager. Find the downloads folder with your extracted convers.js files. In my case it is ~/Downloads/c/converse.js-3.3.4. Be sure to be in the folder, so you see the files like dev.html. In another tab or window, open up the place that you made your new app, in may case it is ~/ubports_apps/xmmpapp/xmppapp. Be sure to be in this folder so that you see the www folder.
Open the www folder, and drag all of the contents of the converse folder into it. It will ask you if you want to overwrite index.html, say yes. You are 60% done! Five minutes down, five minutes to go!
Now back to you (hopefully) still open terminal. You should still be in the folder outside of the folder of the app you just made. Change directory to your app, like so:
$ cd xmppapp/
$ ls
clickable.json manifest.json www xmppapp.desktop
LICENSE README.md xmppapp.apparmor
$
Typing the ls command should show the same files I have, if you named the app the same as I did. Plug in your phone and be sure developer mode is enabled with Settings->about->Developer mode. You are 80% there!
All you have left to do is type:
$ clickable
Copied files to temp directory for click building
Successfully built package in ‘./xmppapp.alaskalinuxuser_1.0.0_all.click’.
3724 KB/s (3190648 bytes in 0.836s)
Installing files [=========================]
Finished [=========================]
Installing files [=========================]
Starting [=========================]
Finished [=========================]
Installed xmppapp.alaskalinuxuser-1.0.0.all (installed:click,removable=1,app_name=xmppapp) summary goes here
$
And you are 100% done! If all went as well as it did here, you should see this:
And now you can start jabber-ing! Obviously, you need an account somewhere. Currently, with this setup, you are using conversjs.org’s BOSH server, and you can connect to your xmpp server. However, this should only be done for testing purposes.
To really utilize this app, you should set up your own BOSH server, and perhaps your own XMPP server. I use ejabber2, so it is an XMPP server and a BOSH server all in one. In the index.html file is this line:
bosh_service_url: ‘https://conversejs.org/http-bind/’,
which should point to your BOSH server. But for testing purposes, the above line works flawlessly. Just recognize that since you are borrowing their BOSH server, it may be down at their leisure, or they can give your sessions the boot if they so desire.
As is, this app will run a non-encrypted conversation with no issues at all. Encryption does work, but it seems a bit funky. I was able to have one successful encrypted conversation, and two that were failures at encrypting. One other issue is that when you close the app, your encrypted “tunnel” ends, so you need to re-establish encryption after that, and I think you have to make sure that the other user turns off encryption so you can re-encrypt with them again.
Big thanks to the convers.js team for making such a great java script that we could drop into our app!
Linux – keep it simple.