Click here to Skip to main content
13,291,254 members (64,186 online)
Click here to Skip to main content
Add your own
alternative version


8 bookmarked
Posted 3 Sep 2011

Register New Account using Matrix XMPP Library

, 3 Sep 2011
Rate this:
Please Sign up or sign in to vote.
Register New Account using Matrix XMPP Library


In this article, I'm going to explain how to create a new account on XMPP server using MatriX library.

What is MatriX

MatriX is a library for the eXtensible Messaging and Presence Protocol (XMPP) for the Microsoft .NET platform. MatriX can be used to build high quality and high performance XMPP Software products.

To get started with the Matrix XMPP library, you can download the SDK here.

What is XMPP

XMPP is a shortcut of Extensible Messaging and Presence Protocol, which is an open standard communication protocol for message-oriented middleware based XML. The XMPP is an open XML technology for real-time communication, which powers a wide range of applications including instant messaging, presence, media negotiation, whiteboarding, collaboration, lightweight middleware, content syndication, and generalized XML routing.

Register New Account

Here you need to set the username, password and domain name of the XMPP server.

If you are going to create a new account, you need to enable the RegisterNewAccount as xmppClient.RegisterNewAccount = true.

XmppClient regXmppClient = new XmppClient();

    regXmppClient.OnRegister += new EventHandler<matrix.eventargs />(xmppCon_OnRegister);
    regXmppClient.OnRegisterInformation += 
			new EventHandler<matrix.xmpp.register.registereventargs />(xmppCon_OnRegisterInformation);
    regXmppClient.OnRegisterError += new EventHandler<matrix.xmpp.client.iqeventargs />(xmppCon_OnRegisterError);

    regXmppClient.SetXmppDomain("Your domain");
    regXmppClient.Password = password;
    regXmppClient.RegisterNewAccount = true;



private void xmppCon_OnRegisterInformation(object sender, RegisterEventArgs e)
    e.Register.Username = regXmppClient.Username;
    e.Register.Password = regXmppClient.Password;

private void xmppCon_OnRegister(object sender, Matrix.EventArgs e)
    //Registration success

private void xmppCon_OnRegisterError(object sender, IqEventArgs e)

What is BOSH

BOSH is standard for Bidirectional-streams Over Synchronous HTTP and it can be used to transport XMPP stanzas. The result is an HTTP binding (BOSH) for XMPP communications that is useful in situations where a device or client is unable to maintain a long-lived TCP connection to an XMPP server.

How to Use BOSH

If you are going to use BOSH instead of socket, you need to set the transport type as BOSH.

regXmppClient.Transport = Matrix.Net.Transport.BOSH;
regXmppClient.Uri = new System.Uri("http://localhost:5280/http-bind");

Get the Latest Binary

Get the latest version of MatriX library from here.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer (Senior)
Singapore Singapore
No Biography provided

You may also be interested in...


Comments and Discussions

Questionxmpp server Pin
Ravenet12-Dec-13 15:21
memberRavenet12-Dec-13 15:21 
QuestionLicensing for Matrix Libraries. Pin
calvfre5-Sep-11 18:33
membercalvfre5-Sep-11 18:33 
AnswerRe: Licensing for Matrix Libraries. [modified] Pin
K.Kirivarnan6-Sep-11 1:28
memberK.Kirivarnan6-Sep-11 1:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.171207.1 | Last Updated 3 Sep 2011
Article Copyright 2011 by K.Kirivarnan
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid