jchristn/WatsonWebsocket

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?

#27

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)?

It can send data to the server.
But if the server is not started, the program hangs forever.

Besides, I need sth like this:
image

You could always do bool success = _Client.SendAsync(curText); followed by if (!success)

You could always do bool success = _Client.SendAsync(curText); followed by if (!success)

I cannot. Otherwise I would not start this issue.
image

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!