XMPP: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
mNo edit summary
Brian Wilson (talk | contribs)
mNo edit summary
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
XMPP is the Jabber protocol.  
XMPP is the Jabber protocol.  
It is also used for GoogleTalk
It was used for GoogleTalk once upon a time.


See [http://xmpp.org/ here] for official documentation
See [http://xmpp.org/ here] for official documentation
or [http://en.wikipedia.org/wiki/Extensible_Messaging_and_Presence_Protocol here] for the Wikipedia page.
or [http://en.wikipedia.org/wiki/Extensible_Messaging_and_Presence_Protocol here] for the Wikipedia page.


I am interested in it for use with [[FoxtrotGPS]] and [[IncidentView]].
Currently I am looking for a way to send messages along to my phone from Twilio
and they are dragging their feet on Whatsapp support. And I don't want to use SMS anymore, to avoid Ting charges.


I want to pass specific bits of data along from a server to a laptop in the field.
I should use push messages (Amazon SNS or Twilio Notify which both wrap around Google) but I don't want to write a custom Android app today. If I use XMPP I think I can put a client on the phone and get started right away, today.


Use cases:
Use cases:


* '''E911 Dispatch''' In IncidentView I want to be able to pass along the information from a 911 dispatch center to a rig.
* Gateway for SMS from Twilio to a smartphone or laptop.  
* '''AVL for IncidentView''' I want to be able track locations on a Web map and convey the location database back to command vehicles.
* '''AVL for FoxtrotGPS''' I want to be able to show the locations of "friends". Aka  
* '''AVL for FoxtrotGPS''' I want to be able to show the locations of "friends". Aka  
"presence information" http://en.wikipedia.org/wiki/Presence_information
"presence information" http://en.wikipedia.org/wiki/Presence_information
== Clients ==
=== GUI clients ===
* adium - Mac version of pidgin
* empathy (comes with Ubuntu) limited usefulness, I uninstalled it
* pidgin - works well, this and adium are the ones I use. http://pidgin.im
* psi - has more debugging modes. http://psi-im.org/
=== Command line ===
The sendxmpp command line client can be install on Linux systems. It's on '''dart'''.
date | sendxmpp -u [email protected] -p PASSWORDHERE --jserver kilchis.alseageo.com [email protected]
If you create a file .sendxmpprc file you can put a single line in it with a username and password for example
cat > .sendxmpprc
[email protected] mypassword
then the send line becomes as simple as
echo "hi brian" | sendxmpp [email protected]
=== Android ===
Control your phone via XMPP: http://code.google.com/p/gtalksms/
'''GtalkSMS''' is built with: https://github.com/Flowdalic/asmack
Looks like it watches services on the phone and sends XMPP messages
so for example it will gate SMS to XMPP, the opposite of what I want.
There are about 50 apps in the "store" when I ask for XMPP; these came up at the top today.
* astrachat
* pix-art messenger
* xabber '''*ad-free! free!'''
* xmpp messenger
I vaguely remember xabber and it says it's installed. That means it was installed on some phone I had a few years ago.
=== Python ===
Following along in the O'Reilly book I will build a simple client using Sleek.
[[Python XMPP Client]]
=== Working with .Net ===
See [[Jabber.net]]
=== Building pidgin ===
..because I am interested in libpurple for Windows (and pidgin runs on Windows)
Downloaded and unpacked source from pidgin site.
It is easy on Ubuntu 12.04, once you install the build dependencies.
apt-get build-dep pidgin
cd pidgin
./configure
make
sudo make install


== Servers ==
== Servers ==


First I need a server. A very popular server is GoogleTalk. But I am not in a Googly mood right now so first order of the day is to get a private server running.
I am setting up a Docker container on [[Bellman]] to run Openfire which (a few years ago anyway) I found to be the best option.
 
These instructions for setting up a Docker version are excellent: https://hub.docker.com/r/gizmotronic/openfire
 
My command is
docker run --name openfire -d --restart=always \
  --publish 9090:9090 --publish 5222:5222 --publish 7777:7777 \
  --volume /home/docker/volumes/openfire_xmpp:/var/lib/openfire \
  gizmotronic/openfire:4.2.3
 
To access the log file,
docker exec -it openfire tail -f /var/log/openfire/info.log
 
Shell access,
docker exec -it openfire bash
 
=== XMPP and your firewall ===


Requirements
Open port 5222 to allow normal messages to pass between client and server. If you have SSL installed use port 5223.
# Free
If you want server to server communications then open port 5269.
# Open source
# Runs on Linux


=== Openfire ===
=== Openfire ===


Openfire - my notes from last attempt pubsub not working
Openfire http://www.igniterealtime.org/projects/openfire/ - my notes from last attempt said "pubsub not working"
3.8.1 says they have fixed pubsub so I am trying again
3.8.1 says they have fixed pubsub so I am trying again


Installed from DEB package. The web interface seems reasonable.  
Installed from packages downloaded from http://www.igniterealtime.org/downloads/index.jsp#openfire (Wget does not work!)
On CentOS the package is configured via /etc/sysconfig/openfire.
 
The web interface seems reasonable.  
Supports groups.
Supports groups.


Line 45: Line 126:
==== PostgreSQL ====
==== PostgreSQL ====


'''DOES NOT WORK''' with Openfire's instructions.
With 3.8.2 set up on Dart with PostgreSQL was easy.


Database URL: jdbc:postgresql://localhost:5432/openfire
http://10.1.10.70:9090/setup/index.jsp
 
I get blocked with this error.
"The Openfire database schema does not appear to be installed. Follow the installation guide to fix this error."
 
==== MySQL ====
 
Okay, mysql is faster and simpler anyway. '''AND IT WORKS''' with Openfire on the first try...
 
cd /usr/share/openfire/resources/database
mysqladmin -u root -p create openfire
mysql -u root -p openfire < openfire_mysql.sql
 
Via phpmyadmin
CREATE USER 'openfire'@'localhost' IDENTIFIED BY '***';
GRANT USAGE ON * . * TO 'openfire'@'localhost' IDENTIFIED BY '***' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
GRANT ALL PRIVILEGES ON `openfire` . * TO 'openfire'@'localhost';
 
Database URL: jdbc:mysql://localhost:3306/openfire?rewriteBatchedStatements=true


==== Plugins ====
==== Plugins ====
Line 76: Line 139:


To send a broadcast message, send a message to all@[serviceName].[serverName] or [group]@[serviceName].[serverName]. For example, if your server is called foo and the default service name is being used, a message to [email protected] would be broadcast to all users connected to the server. For the group staff, a message to [email protected] would be sent to all users in the group staff that are currently online or offline.
To send a broadcast message, send a message to all@[serviceName].[serverName] or [group]@[serviceName].[serverName]. For example, if your server is called foo and the default service name is being used, a message to [email protected] would be broadcast to all users connected to the server. For the group staff, a message to [email protected] would be sent to all users in the group staff that are currently online or offline.
==== Custom plugins ====
I need a plugin that will receive a location (XEP-0080) and write it to a PostGIS table.


=== Prosody ===
=== Prosody ===


[http://prosody.im/ Prosody] - my notes say use this one, but trying out Openfire because of the plugins.
[http://prosody.im/ Prosody] - my notes say use this one, but trying out Openfire because of the plugins.
== Clients ==
=== Python ===
Following along in the O'Reilly book I will build a simple client using Sleek.
[[Python XMPP Client]]
=== Working with .Net ===
See [[Jabber.net]]
=== Building pidgin ===
..because I am interested in libpurple for Windows (and pidgin runs on Windows)
Downloaded and unpacked source from pidgin site.
It is easy on Ubuntu 12.04, once you install the build dependencies.
apt-get build-dep pidgin
cd pidgin
./configure
make
sudo make install


== Location ==
== Location ==
Line 124: Line 158:


Container (what XMPP message should carry the location data?):
Container (what XMPP message should carry the location data?):
* Location of people should be sent via pub-sub or pep (personal eventing).
* Location of people should be sent via PubSub or PEP(personal eventing).
* Tracking non-human users (eg a fire truck) can use other containers.
* Tracking non-human users (eg a fire truck) can use other containers.


Line 130: Line 164:
* Lat / lon are signed decimal degrees
* Lat / lon are signed decimal degrees
* Altitude units are metric
* Altitude units are metric
May 3, 2010 3:07 AM (in response to Disturbed1)
Re: Use OpenFire for geolocation
Hi,
we at buddycloud.com do some geoloc stuff via pubsub! You may just join our groupchat at [email protected]
It's actually the reason that asmack exists, so feel free to get some input on geoloc, pubsub and pep there :-) The server implementation is actually all about managing pubsub nodes....
http://fisheye.igniterealtime.org/browse/svn-org/smack/trunk/test/org/jivesoftware/smackx/pubsub
[[Category:Messaging]]

Latest revision as of 15:56, 27 October 2021

XMPP is the Jabber protocol. It was used for GoogleTalk once upon a time.

See here for official documentation or here for the Wikipedia page.

Currently I am looking for a way to send messages along to my phone from Twilio and they are dragging their feet on Whatsapp support. And I don't want to use SMS anymore, to avoid Ting charges.

I should use push messages (Amazon SNS or Twilio Notify which both wrap around Google) but I don't want to write a custom Android app today. If I use XMPP I think I can put a client on the phone and get started right away, today.

Use cases:

  • Gateway for SMS from Twilio to a smartphone or laptop.
  • AVL for FoxtrotGPS I want to be able to show the locations of "friends". Aka

"presence information" http://en.wikipedia.org/wiki/Presence_information

Clients

GUI clients

  • adium - Mac version of pidgin
  • empathy (comes with Ubuntu) limited usefulness, I uninstalled it
  • pidgin - works well, this and adium are the ones I use. http://pidgin.im
  • psi - has more debugging modes. http://psi-im.org/

Command line

The sendxmpp command line client can be install on Linux systems. It's on dart.

date | sendxmpp -u [email protected] -p PASSWORDHERE --jserver kilchis.alseageo.com [email protected]

If you create a file .sendxmpprc file you can put a single line in it with a username and password for example

cat > .sendxmpprc
[email protected] mypassword

then the send line becomes as simple as

echo "hi brian" | sendxmpp [email protected]

Android

Control your phone via XMPP: http://code.google.com/p/gtalksms/ GtalkSMS is built with: https://github.com/Flowdalic/asmack Looks like it watches services on the phone and sends XMPP messages so for example it will gate SMS to XMPP, the opposite of what I want.

There are about 50 apps in the "store" when I ask for XMPP; these came up at the top today.

  • astrachat
  • pix-art messenger
  • xabber *ad-free! free!
  • xmpp messenger

I vaguely remember xabber and it says it's installed. That means it was installed on some phone I had a few years ago.


Python

Following along in the O'Reilly book I will build a simple client using Sleek. Python XMPP Client

Working with .Net

See Jabber.net

Building pidgin

..because I am interested in libpurple for Windows (and pidgin runs on Windows)

Downloaded and unpacked source from pidgin site.

It is easy on Ubuntu 12.04, once you install the build dependencies.

apt-get build-dep pidgin
cd pidgin
./configure 
make
sudo make install


Servers

I am setting up a Docker container on Bellman to run Openfire which (a few years ago anyway) I found to be the best option.

These instructions for setting up a Docker version are excellent: https://hub.docker.com/r/gizmotronic/openfire

My command is

docker run --name openfire -d --restart=always \
 --publish 9090:9090 --publish 5222:5222 --publish 7777:7777 \
 --volume /home/docker/volumes/openfire_xmpp:/var/lib/openfire \
 gizmotronic/openfire:4.2.3

To access the log file,

docker exec -it openfire tail -f /var/log/openfire/info.log

Shell access,

docker exec -it openfire bash

XMPP and your firewall

Open port 5222 to allow normal messages to pass between client and server. If you have SSL installed use port 5223. If you want server to server communications then open port 5269.

Openfire

Openfire http://www.igniterealtime.org/projects/openfire/ - my notes from last attempt said "pubsub not working" 3.8.1 says they have fixed pubsub so I am trying again

Installed from packages downloaded from http://www.igniterealtime.org/downloads/index.jsp#openfire (Wget does not work!) On CentOS the package is configured via /etc/sysconfig/openfire.

The web interface seems reasonable. Supports groups.

Shows active sessions.

Has chat rooms. I think this could be a way to send dispatches to a group of users. I can also use the 'broadcast' plugin.

brian/wildsong bwilson/alseageo iv/iv saint/thebells

PostgreSQL

With 3.8.2 set up on Dart with PostgreSQL was easy.

http://10.1.10.70:9090/setup/index.jsp

Plugins

You can install plugins directly from the web interface.

I installed the Asterisk plugin.

I installed the Broadcast plugin. "The broadcast plugin broadcasts messages to all users in the system or to specific groups. It's primarily useful for sending announcements or notifications."

To send a broadcast message, send a message to all@[serviceName].[serverName] or [group]@[serviceName].[serverName]. For example, if your server is called foo and the default service name is being used, a message to [email protected] would be broadcast to all users connected to the server. For the group staff, a message to [email protected] would be sent to all users in the group staff that are currently online or offline.

Prosody

Prosody - my notes say use this one, but trying out Openfire because of the plugins.

Location

There are two docs to look at: xep-0080 to report where client is located and xep-0255 to ask about the location of an entity.

All about XEP-0080

What is XEP-0080 good for?

  • Supports GPS related attributes (aka xml elements) you expect including {timestamp, lat, lon, alt, speed, bearing, datum}
  • Also has elements for everything you might want (floor, street, country, postalcode etc etc)

XEP-0080 message format could easily support E911 dispatch. It includes 'description', 'url' and a catch-all 'text' element.

Container (what XMPP message should carry the location data?):

  • Location of people should be sent via PubSub or PEP(personal eventing).
  • Tracking non-human users (eg a fire truck) can use other containers.

Musts:

  • Lat / lon are signed decimal degrees
  • Altitude units are metric

May 3, 2010 3:07 AM (in response to Disturbed1) Re: Use OpenFire for geolocation

Hi, we at buddycloud.com do some geoloc stuff via pubsub! You may just join our groupchat at [email protected]

It's actually the reason that asmack exists, so feel free to get some input on geoloc, pubsub and pep there :-) The server implementation is actually all about managing pubsub nodes....

http://fisheye.igniterealtime.org/browse/svn-org/smack/trunk/test/org/jivesoftware/smackx/pubsub