How to close a connection
var conn = new XSocketClient("ws://localhost:4502", "http://localhost", "chat");
await conn.Open();
// ... do stuff
// Close the connection
conn.Disconnect();
You might also find the section about Lifetime Events interesting.