SendAsync(msg).Wait(1000) always "false" on custom server
Closed this issue · 9 comments
I'm buiding a communication between c# (WatsonWebsocket) and cpp (Websocket server).
When calling SendAsync(msg).Wait(1000)
, it seems the result is always false
though I can guarantee the server has received the message.
As I'm not using WatsonWebsocket
to build the server, I assume I need to send something back from my custom server so that the WastonClient
knows the message is sent correctly?
What should I send back?
If I try to use SendAsync(msg).Result
it takes forever to return the bool
result... Never get it.
You shouldn't have to send anything back from the server. What happens if you do it without .Wait(1000)
?
You could always do bool success = _Client.SendAsync(curText);
followed by if (!success)
I think we're also missing functions like client.IsRunning
to check the status of the client?
May I ask how should I check if a client is connected to to server?
OK, I got it to work by
bool success = await _Client.SendAsync(curText);
And found Connected
properties.
Right, sorry, I should have said bool success = await ...
, good catch!