• Version 1.7.1
Show / Hide Table of Contents

Listening to Session Events

To be notified about a session event, subscribe to the corresponding event of the Session class.

Note

Session event handling/listening is the synchronous operation, so it is recommended not to perform time-consuming tasks inside event handlers.

Example

session.InboundApplicationMessage += (sender, args) => Console.WriteLine("Inbound application message: " + args.Message);
session.StateChanged += (sender, args) => Console.WriteLine($"Session state was changed from {args.PreviousState} to {args.NewState}.");
session.Warning += (sender, args) => Console.WriteLine("WARNING: " + args.Description);
session.Error += (sender, args) => Console.WriteLine("ERROR: " + args.Description);
In this article
Back to top Copyright © Onix Solutions.
Generated by DocFX