O'Reilly logo

Mastering Internet of Things by Peter Waher

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Following the connection process

By using the OnStateChanged and OnConnectionError events, we have a simple mechanism with which we can follow the connection process. We also become aware of the Full JID of the connection, once the connection has become active and you're fully connected to the XMPP network:

private void StateChanged(object Sender, XmppState State) 
{ 
Log.Informational("Changing state: " + State.ToString()); 
 
if (State == XmppState.Connected) 
Log.Informational("Connected as " + 
this.xmppClient.FullJID); 
} 
 
private void ConnectionError(object Sender, Exception ex) 
{ 
Log.Error(ex.Message); 
} 

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required