Inside Nokia Chat’s XMPP

I’ve been experimenting with the beta of Nokia Chat for the past few days; it’s an interesting application, with lots of promise, and is pleasantly open, in that it’s built on the XMPP protocol. This is the same protocol used by Jabber and Google Talk, and so Nokia Chat interoperates nicely with those services (you cannot, however, use an existing Jabber or Google Talk account with Nokia Chat — you’re forced to create a new “@ovi.com” account).

The tag-line for Nokia Chat is “more than just messaging” and its ability to share location, using the built-in GPS in modern Nokia devices, is the feature that is used to differentiate it from other instant messaging apps.

How this actually works isn’t immediately obvious unless you happen to be using the application to chat to other Nokia Chat users, as the location sharing features aren’t even on the menu when you’re chatting with users on other networks. Here, for example, is what my Nokia Chat menu looks like when I’m chatting with Mark, who’s using Jabber.org:

Nokia Chat Menu: with a Jabber.org contact - Share on Ovi

Compare this to a chat with another Nokia Chat user; there’s now a “Send” menu option, with two sub-options, “Voice message” and “My location.”

Nokia Chat Menu: with another Nokia Chat contact - Share on Ovi

Now in this case the user I’m chatting with is actually a xmpphp script that’s signed into another Nokia Chat account. Because of this I was able to watch the actual XML being sent back and forth; what I found was that if this script advertised its presence like this:

<?xml version="1.0"?>
<presence>
	<status>Experimenting</status>
</presence>

then Nokia Chat didn’t show the special “Send” menu. However if I modified the script to advertise that I was a client with some additional capabilities:

<?xml version="1.0"?>
<presence>
	<c xmlns="http://jabber.org/protocol/caps" 
	   node="http://chat.ovi.com/caps" 
	   ver="1.0" 
	   ext="mobi loc-1 vim-1"/>
	<priority>1</priority>
	<status>Experimenting</status>
</presence>

then Nokia Chat took me to be capable of receiving location (loc-1) and voice message (vim-1) presence updates and acted accordingly, displaying the “Send” menu as above.

So what actually gets sent when I select “Send \| My location” to a contact from within Nokia Chat? Simply more XML, it turns out, using the geoloc XMPP extension:

<?xml version="1.0"?>
<message from="#######" to="="#######" ">
	<body>
	    This message contains a location.
	</body>
	<geoloc 
	    xmlns="http://jabber.org/protocol/geoloc" 
	    xml:lang="en">
		<lat>46.235998566402</lat>
		<lon>-63.129852545897 </lon>
	</geoloc>
	<x xmlns="jabber:x:oob">
		<url>(mapquest url here)</url>
	</x>
</message>

(The message also contains a link to a Mapquest.com URL which I’ve removed in the XML above for brevity).

On the receiving side, when someone sends you a location in Nokia Chat, the message looks like this:

Receiving a Location in Nokia Chat - Share on Ovi

When you select the “Open” link, the Nokia Maps application starts up and zooms to the given location.

Because this is all done using XML, using published protocols, the door is open to build all sorts of interesting applications that hook into Nokia Chat. Sending location information, for example, to a XMPP-speaking bot, would provide a built-in mechanism for sending location updates to a web application.

Stay tuned for more experimenting.

Comments

Stefan Sarzio's picture
Stefan Sarzio on July 27, 2008 - 06:03

Great work! Thanx for sharing. :-)

inte's picture
inte on July 1, 2010 - 10:43

Ovi-Chat <→ Google Talk connection DO work.
You can simply connect to Google Talk users by adding them to your contact list.
You could also connect to the Nokia OVI chat service from XMPP clients such as iChat by simply adding your account data (<username>@ovi.com) and the Nokia XMPP server (chat.ovi.com), SSL-Port 5223.

Add new comment