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.

Silverlight XMPP setup guide for MatriX

It looks like many developers have problems to setup and debug Silverlight applications with MatriX.

There are different ways to setup a XMPP connection with MatriX

  1. direct socket connection on a port within the Silverlight port range
  2. direct connection over a HTTP proxy with the CONNECT command (HTTP tunneling)
  3. BOSH connection

Silverlight has different network security access restrictions for sockets and web requests. If you choose option 1 or 2 then the socket policies apply, if you choose 3 then the web request policy apply because MatriX is using .NET WebRequest classes for the connections. Read more details about the Silverlight network security access restrictions here.

Silverlight allows socket connections only on ports 4502-4534. For option 1 and 2 this means you have to configure your XMPP or proxy server to listen on a port within this port range, or use other technologies like port forwarding to redirect connections to the XMPP default port 5222. Before a socket can be connected the Silverlight runtime requests the policy on the target site at port 943 and checks the permissions.You have to run a policy server which must be able to serve requests on the same domain as your XMPP or proxy server is hosted.

When using BOSH and crossing domains the Silverlight runtime requests a policy xml file from the root of the BOSH Uri. This means you can connect to other XMPP servers (not under your control) only if they host a policy file on the root of the BOSH Uri which allows you to connect. Or you run your own BOSH server which is able to connect to any XMPP server in the federated network. Punjab is a good choice for the latter.

Example:
when the BOSH Uri is http://example.com:5280/http-bind/ the Silverlight runtime request either a Flash policy file at http://example.com:5280/crossdomain.xml or a Silverlight policy file at http://example.com:5280/clientaccesspolicy.xml when crossing domains.

To avoid cross domain requests on your own server you can either

  • choose a XMPP server which allows you to host your application on the BOSH Uri
  • proxy from your web server to the BOSH server e.g. with mod_proxy in Apache.
Crossing domains would be much easier if all BOSH components allow you to serve the policy files at the root of the BOSH Uri.

All this policy stuff makes not much sense to me, but this is what Adobe and Microsoft came up with. So we have to deal with it.

MatriX Mobile released

I am pleased to announce the availability of MatriX Mobile for the .NET Compact Framework. This is the 3rd product in the MatriX series. Now MatriX is available for all major .NET platforms.

  • full .NET Framework
  • .NET Compact Framework
  • Silverlight

This allows you to use one API for Desktop, Mobile and Web Development and reuse lots of your code to shorten your development time.

Download Matrix here.

MatriX for .NET released

I am pleased to announce the availability of MatriX for the full .NET Framework.

This is the second product in the MatriX series. The next step now is MatriX mobile for the .NET Compact Framework which I expect to be released Jan 2010. This will allow you to use one API for Desktop, Mobile and Web Development and reuse lots of your code to shorten your development time. The version number was adjusted to 1.10 to be in sync with MatriX for Silverlight.

Download Matrix here.

Silverlight 3.0

Silverlight 3 has been announced at MIX09 for late summer this year. According to Microsoft the Silverlight browser plugin is installed on 300 millions machines, Adobe Flash on 950 million machines. So Silverlight catches up here very fast.

Silverlight adoption has the potential to happen very fast because of the following reasons:

  • There is a continuous trend towards rich Internet applications. Of course good developers can create great web applications with HTML, DHTML, Ajax, JQuery and other technologies. But with Silverlight every average developer is able to do the same in less time. This brings products faster to the market and gives you an advantage over your competitors.
  • Silverlight opens rich Internet web development to all of the 4+ million .NET developers worldwide without learning new technologies and programming languages.
  • Another big advantage with the upcoming Silverlight version is that applications can run out of the browser as regular (cross platform) desktop applications without no code changes.
  • You can also reuse most of the code to build regular .NET WPF desktop application, or vice versa. It is pretty easy to port WPF desktop applications to Silverlight, because Silverlight is using a WPF subset for the GUI.

For existing c# or vb .NET developers Silverlight is very attractive because existing skills can be reused with the same base class library without laerning new technolgies. When do you start Silverlight hacking?

MatriX for Silverlight 1.10 released

I am happy to announce MatriX for Silverlight 1.10.
New additions in this version are:

  • Multi User Chat
  • Vcard
  • Avatars
  • many other small improvements
Here you can see a screenshot of the Silverlight MUC client with avatars. Silverlight MUC

You can see the Silverlight MUC client in action here.

MUC for Silverlight

in the last days I was working on MUC extensions for MatriX.

If you have the Silverlight Browser plugin installed you can test the Silverlight MUC client here.

I will add more MUC features to MatriX and the client, and make a new release of MatriX soon.

Silverlight MUC

MatriX for Silverlight released

I am pleased to announce the first release of MatriX for Microsoft Silverlight.

MatriX is a XMPP library for Microsoft Silverlight web development written in c#. Currently MatriX supports the XMPP core. I am working hard on adding many new features and XEPs. You can expect some updates with new features in the next weeks.

Download MatriX here:
http://www.ag-software.net/matrix-xmpp-sdk/

look at the demo client here:
http://matrix.ag-software.de