SRV records

XMPP is using SRV records to lovate the hostname and port of the XMPP service automatically. When your server is using or requires SRV records then add the Matrix.vNext.Srv nuGet package to you application and use the SrvNameResolver as shown in the following example. MatriX will automatically query for SRV records when the connection gets initialted.

Example SrvNameResolver

var xmppClient = new XmppClient(pipelineInitializerAction)
{
XmppDomain = "example.com",
HostnameResolver = new SrvNameResolver()
};


If you don’t want to use SRV records you can also specify the hostname and port manual. This is often useful in development for testing purposes. But there are servers which do not use SRV records, and where the server hostname does not match the XMPP domain. In those cases the hostname must be set manual by the application. This where we use a StaticNameResolver.

Example: setting host and port manual

var xmppClient = new XmppClient(pipelineInitializerAction)
{
XmppDomain = "example.com",
// use a local server for dev purposes running
// on a non standard XMPP port 5333
HostnameResolver = new StaticNameResolver("localhost", 5333)
};


Example: setting Ip and port manual

var xmppClient = new XmppClient(pipelineInitializerAction)
{