I am working with Qt websockets.
Wanted to ask you, do you know how could I make this communication:
for example I have this two methods and I would like to send message to server, than wait for response (because it refreshes the data
variable) and than proccess myMethod()
client->sendMessageToServer();
myMethod(data);
Sure I could use Signal and Slots... but dont know how could I use it here, see:
when I go sendMessageToServer()
ok it will send message to server
void Client::sendMessageToServer(QString &str){
m_wSocket.sendTextMessage(str);
}
what should I emit than? I have no idea how to be in waiting state... there is no such a slot in QWebSocket
, it just go to method myMethod
immediately.
It doesn't go here where the data are set:
btw I have setup client like this when it recieves message it goes to onTextMessageRecieved
because of this:
connect(&m_wSocket, &QWebSocket::textMessageReceived, this, &Client::onTextMessageReceived);
void Client::onTextMessageReceived(QString message)
{
setData(message);
}
Do you have any idea?