.NET クライアントで SignalR を使用しようとしています。正常に接続できますが、イベントをサブスクライブしようとしても何も起こりません。サーバーから送信されたメッセージを受信できません。私はこの分野に非常に慣れていないので、コードに何かが欠けているのか、それとも何かが間違っているのかわかりません。
var hubConnection = new HubConnection(<url>);
// Hub name from dev code
var proxy = hubConnection.CreateHubProxy("pidHub");
// Subscribing to all the events
proxy.On("SendTransactionUpdate", () => Logger.LogInformation("SendTransactionUpdate ************************"));
proxy.On("SendMessage", () => Logger.LogInformation("SendMessage ************************"));
proxy.On("UpdateStatus", () => Logger.LogInformation("UpdateStatus ************************"));
proxy.On("TransactionUpdate", () => Logger.LogInformation("TransactionUpdate ************************"));
// This block executes fine
hubConnection.Start().ContinueWith(task =>
{
if (task.IsFaulted)
{
Logger.LogInformation("There was an error opening the connection: {0}" + task.Exception.GetBaseException());
}
else
{
Logger.LogInformation("Connected. *********");
}
}).Wait();
// Call Provision GUID API and returns a valid GUID
<call API>
// Downloads EXE on machine
<download EXE code>
// Run EXE with -d option
// EXE uploads results back to the server and server returns some messages through SignalR
// I want to capture these messages
<execute EXE on machine>