How to close Xsocket client connection using the C# client API in XSockets

159 views Asked by At

My Xsocket client:

Connect(Object module)
    {
        var socket = new XSocketClient("wss://localhost:46000/SocketController", "https://somesites.com", CertUtils.RetrieveX509Certificate2());
        socket.Open();                
        var list = new List<Task>();
        list.Add(Task.Factory.StartNew(() => socket.Send(new { Module = module, Action = "GetStatus" }, "Exec")));
        list.Add(Task.Factory.StartNew(() => socket.Send(new { Module = module, Action = "GetStatus" }, "Exec")));
        list.Add(Task.Factory.StartNew(() => socket.Send(dataupdate, "Update")));
        Task.WaitAll(list.ToArray());
    }

Call 1: Connect(....) /Sucess/

Call 2: Connect(....) /System execption: You cant send messages when not conencted to the server/

Call 3: Connect(....) /System execption: You cant send messages when not conencted to the server/

1

There are 1 answers

0
Uffe On

I assume that you are referring to XScokets.NET. If so you can read the documentation on GitBook. If you are using a XSockets library in C# that I am not familiar with you can ignore this answer :)

Your connection looks a bit strange since certificates are added like this

Edit: if you are using XSockets.NET, what version are you using?