MatriX vNext

MatriX vNext is the latest interation of our XMPP libraries which are now around for about 2 decades now.

MatriX is based on .Net Core and netStandard. With this new iteration we also took the opportunity for a major rewrite and redesign of the whole 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");

Releases are available as a Nuget packages here: https://www.nuget.org/packages/Matrix.vNext

more info and documentation is coming soon ….