Microsoft adds XMPP support to Windows Live Messenger

This are great news for the XMPP community. Microsoft has added XMPP client support to their Windows Live servers. You can read the announcement here.

Microsoft does not support any of the mandatory SASL mechanisms SCRAM, DIGEST-MD5 and PLAIN. Instead they have implemented their own X-MESSENGER-OAUTH2 SASL mechanism. This means that all existing XMPP Software is not able to connect to their server without code changes or updates.

I have updated the MatriX library to support the X-MESSENGER-OAUTH2 SASL mechanism. You can download the latest binary here.

Here is an example how you can connect to Windows Live Messenger with MatriX.
The XMPP domain is messenger.live.com. Microsoft has the proper SRV records, so MatriX discovers the hostname automatically. All you have to do is subscribe to the OnBeforeSasl event and disable the the automatic SASL mechanism selection and choose the X_MESSENGER_OAUTH2 mechanism for authentication. Additional you have to pass SaslProperties which include your access token.

var xmppClient = new XmppClient {XmppDomain = "messenger.live.com"};
xmppClient.OnBeforeSasl += xmppClient_OnBeforeSasl;
xmppClient.Open();

private void xmppClient_OnBeforeSasl(object sender, SaslEventArgs e)
{
	e.Auto = false;

	const string ACCESS_TOKEN = "your_access_token";
	e.SaslMechanism = SaslMechanism.X_MESSENGER_OAUTH2;
	e.SaslProperties = new LiveMessengerProperties
						   {
							   AccessToken = ACCESS_TOKEN
						   };
}

Of course you must retrieve your access token before you can connect with MatriX.

Some additional useful resources from Microsoft:

MatriX status update

I have not posted any updates for a while, which does not mean that there aren’t any.
So what I am working on?

There is huge progress in MatriX. Many of our customers are demanding support for special XEPs and other library extensions. So I have been working very close with them implementing many new XEPs and other useful features. I will create separate blog posts for some of these features.

Windows Phone Mango is coming now with sockets. So I have added sockets to the Windows Phone Mango version which is RTM now.

The port of MatriX to Android using mono for Android is nearly finished. You can expect a beta version very soon. Drop me an email when you are interested to join the beta test.

Whats next? Once the Android version is done I will start to work on a iOS version with MonoTouch.

You will be able to target all major mobile platform and reuse lots of your existing code and business logic.

There was no official release for a while, but the latest stable builds are always located here: http://www.ag-software.net/download-directory/

Windows Phone Mango

Today Microsoft has released the Beta Tools for Mango. Mango delivers many new features to Windows Phone developers. The two features we were waiting for are the following:

  • Background processing
  • Networking / sockets for communications

Now you are also able to use sockets instead of BOSH as transport layer on Windows Phone Mango. And your XMPP apps are able to run in background and keep your XMPP connection alive for listening asynchronous on events. This is a big step forward for XMPP and Instant Messaging apps on Windows Phone.

I have implemented sockets in MatriX for Windows Phone. You can download the MatriX beta release for Mango here.

MatriX 1.4 released

I am happy to announce release 1.4 of the MatriX XMPP libraries. There are many minor and major improvements. Here is a small list of changes

  • Silverlight version updated to Silverlight 4.0
  • added ability in Silverlight to download policies over HTTP instead of sockets (new feature in SL4)
  • try to connect to all hosts in the SRV records and all IP adresses when tehre are multiple addresses assigned (full .NET version only)
  • added DIGEST-MD5 to Silverlight and WP7 version (yes there are still many servers which require this SASL mechanism)
  • added non SASL authentication
  • XEP-0033 extended stanza addressing
You can download the new versions here.

Silverlight updates

From now all upcoming releases of MatriX for Silverlight will be compiled against Silverlight 4 because of improvements in the security policy system.

Since Silverlight 4 a connection request using sockets can choose to retrieve the policy file via the HTTP protocol on TCP port 80 instead of the custom TCP protocol on port 943. Web servers are already running in mosts environments. This makes your setup much easier because you don’t need the special policy server on port 943.

To enable policy download over HTTP use the following code in the latest MatriX for Silverlight version.

XmppClient.DownloadClientAccessPolicyViaHttp = true;

You can read more details about the Network Security Access Restrictions in Silverlight here in the MSDN

SRV Record Tester

Because many Windows users are not familiar with tools like nslookup, dig and SRV records I have created a small GUI tool to lookup XMPP SRV Records on Windows.

You can download the tool from the following link.
http://www.ag-software.net/download/xmpp/SrvTester.zip

The .NET Framework 4 Client Profile is required to run this tool.

Screenshot - SRV Record Tester

Screenshot - SRV Record Tester

XMPP notifications for UNB

The Unclassified NewsBoard (short UNB) ist a great, fast and lightweight forums software which is very easy to extend and customize. I use it for many years now. UNB was the 1st board software with XMPP notifications for new replies in threads or users.

I have written now a small plugin which notifies board admins of new created threads. There is no need to poll the RSS feed every X minutes or hours anymore.

You can find the plugin here.

a short MatriX development update

there were no blog posts for a while because I was too very busy with coding.

I released MatriX 1.3 for .NET some days ago. This release includes many new features. To name only some of the latest updates:

  • SASL EXTERNAL
  • SASL SCRAM-SHA-1
  • file tranfer control
  • XPath filering
  • roster versioning
  • …..

Yesterday I successfully compiled and tested MatriX on Windows Phone 7. MatriX for Windows Phone will be the next product to complete the MatriX series released very soon.

If you plan to develop XMPP apps for WP7 or need a XMPP layer for WP7 feel free to contact me.

XPath support for MatriX

XPath support for my XMPP libraries was on my TODO list for a long time. Because agsXMPP is using its own DOM implementation I wasn’t able to use standard XPath libraries. Writing a custom XPath implementation is quite a challenge, and using System.Xml’s XPath functions would require 2 different DOMs and parsing the Xml twice, which was no option for me.

Because MatriX is using System.Xml.LinQ which has XPath support it was pretty easy to get this task done for MatriX now.

Of course you can do filtering based on powerful LinQ statements and the other filter classes in MatriX. But in many cases it’s required to build expressions dynamically on the fly. Also many programmers are familiar with XPath and prefer XPath over LinQ statements. The XPathFilter makes it also much easier to filter big complex stanzas with many nested elements.

The following example describes the usage of the XPathFilter. We setup a filter that matches all presence stanzas from the full Jid ‘user@jabber.org/MatriX’. Because MatriX and XPath in .Net are namespace aware we have to define prefixes in the XmlNamespaceManager. Otherwise we would get no results.

e.Stanza is the complete stanza which matches the expression.
e.Result is the result of the XPath expression. This is useful when you are interested only in fragments of the complete stanza.

void XPathFilter()
{
	xmppClient.XPathFilter.XmlNamespaceManager.AddNamespace("JC", "jabber:client");
	xmppClient.XPathFilter.Add("/JC:presence[@from='user@jabber.org/MatriX']", XPathCallback);
}

void XPathCallback(object sender, XPathEventArgs e)
{
	Debug.WriteLine("Stanza: " + e.Stanza);
	Debug.WriteLine("Result: " + e.Result);
}

Here are some other XPath example expressions to filter stanzas:

  • filter all messages with the exact body of 'Hello MatriX
    /JC:message[JC:body='Hello MatriX']
  • filter all presences where the Jid starts with 'gnauck@'.
    /JC:presence[starts-with(@from ,'gnauck@')]
  • filter all messages of type=error which have a from and and a to Jid
    /JC:message[@from and @to and @type='error']

New MatriX versions released

I am pleased to announce a new MatriX releases. All 3 MatriX editions were updated to 1.2.1.0 and are in sync with the version number now.

This release includes also the first version of the MatriX developer guide with many code examples. I will add continuous more content, code snippets and examples to this guide.

Download the new releases from here.