Simple websocket chat client

Hello!

I am trying to write a simple websocket chat client. It should take input from the user and just send it via websockets. I am using the websocketpp library. Here is the full code I am using https://gist.github.com/purefan/dc5c1d161eae703b1b75bf2cf32874c0

If I send 2 messages programmatically it works fine:

1
2
3
4
5
  std::string message1 = "cpp1";
  send_message(c, hdl, message1);

  std::string message2 = "cpp1";
  send_message(c, hdl, message2);


but if I introduce a getline, even though it seems to execute send_message, the message never leaves the client.

I thought this might be caused by some lock and thats why I tried capturing input in an async lambda but it didn't really help.

Can someone please help me figure out why I cant wait for user input and send via websocket?

Thanks
Topic archived. No new replies allowed.