Introducing MatriX vNext

We are thrilled to announce the next generation of the MatriX XMPP libraries.
15 years elapsed already since we started our first .NET/c# XMPP library agsXMPP with .NET 1.0. Our XMPP libraries and the .NET technologies had many major evolutions over the years.

With the switch to .Net Core we also took the opportunity for a major rewrite and redesign of the codebase. The API for clients, servers and components is not backwards compatible, but all XMPP protocol classes remain the same. Updating existing code bases to MatriX vNext should be pretty straightforward.

Some highlights

  • new software design and more modern API
  • target .Net Core
  • high performance sockets using Azure DotNetty
  • Completly Task based using the TAP pattern (async/await)
  • more Linq extensions
  • Rx (Reactive Extensions)
  • will be open source and available under a dual license (Open Source and commercial)

Here is some demo client code using MatriX vNext:

var xmppClient = new XmppClient
{
    Username = "alex",
    Password = "secret",
    XmppDomain = "server.com",
};

xmppClient
	.XmppXElementStream
	.Where(el => el.OfType<Presence>())
	.Subscribe(el =>
	{
		// Handle incoming presence
		Debug.WriteLine(el.Cast<Presence>().From);
	});

xmppClient
	.XmppXElementStream
	.Where(el => el.OfType<Message>())
	.Subscribe(el =>
	{
		// Handle incoming messages	    
		Debug.WriteLine(el.Cast<Message>().Body);
	});

xmppClient
	.XmppXElementStream
		.Where(el => 
		el.OfType<Iq>
		&& el.Cast<T>().Type == IqType.Get
		&& el.Cast<T>().Query.OfType<Ping>()
	.Subscribe(el =>
	{
		// handle and reply to incoming pings
		var iq = xmppXElement.Cast<T>();

		var resIq = Factory.GetElement<T>();
		resIq.Id    = iq.Id;
		resIq.To    = iq.From;
		resIq.Type  = IqType.Result;

		await xmppClient.SendAsync(resIq);
	});

// connect, secure, authenticate and bind
await xmppClient.ConnectAsync();

// request roster (contact list)
var roster = await xmppClient.RequestRosterAsync();

// send own presence to the server
xmppClient.SendPresenceAsync(Show.Chat, "free for Chat");

A prerelease is available as a Nuget package here: https://www.nuget.org/packages/Matrix.vNext/0.2.0-beta

Comments are closed.