Hello,
I need to make a request to the webserver through signalR, then wait for the response
Is this possible?
Thank you
I need to make a request to the webserver through signalR, then wait for the response
public async Task<object> Ask(object msg)
{
//create the messenger
var sender = new AskActor("asktemp");
Sender = sender;
var noMessage = sender.message;
//send the message
RecieveTarget(msg);
//wait for signalR to send back result
while (sender.message == noMessage)
{
//turn over control for a while
await Task.Delay(100);
}
//kill the messenger
sender.Kill();
//return message
return sender.message;
}
SignalR does not provide a promise or any other form of syncronization, so I just need to put this task on park, allow the java event loop to move to handle the signalR return, and then check if anything happened.Is this possible?
Thank you
Comment