sacOO7 / SocketclusterClientDotNet

C# client for socketcluster framework in node.js
http://socketcluster.io/#!/
Apache License 2.0
69 stars 16 forks source link

Emit is not being received SocketCluster v16 #29

Closed jnschultz closed 4 years ago

jnschultz commented 4 years ago

on C# client.. SocketMessage sockeMessage = new SocketMessage(); sockeMessage.MessageType = "PatientTestResult"; sockeMessage.PatientId = (long)testResult.PatientId; sockeMessage.DoctorId = doctor.Id; socket.Emit("inbound", sockeMessage);

on sever side

(async () => { for await (let {socket} of agServer.listener('connection')) { console.log(connection: ${socket}); (async () => {
for await ( let data of socket.receiver('inbound') ) { console.log(inbound channel: ${data});
(async () => { try { await socket.exchange.invokePublish('outbound', data); } catch (error) { // ... Handle potential error if broker does not acknowledge before timeout. console.log(error: ${error});
} })(); } })(); } }) ();

I never seem to receive 'inbound' on sever

jnschultz commented 4 years ago

I believe I found the issue.. I was placing my .Connect() in the constructor [this was an API call] .. I moved that into the api function .. I had to place a Thread.Sleep(2000) as your example did.. then I called the Disconnect after the Emit and another Sleep ..