Skip to content

Commit 0724360

Browse files
authored
feat(templates): improve SignalR method invoke in bit Boilerplate project template #11066 (#11067)
1 parent 1e88338 commit 0724360

File tree

1 file changed

+5
-1
lines changed
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Controllers/Diagnostics

1 file changed

+5
-1
lines changed

src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Controllers/Diagnostics/DiagnosticsController.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ public async Task<string> PerformDiagnostics([FromQuery] string? signalRConnecti
5858
//#if (signalR == true)
5959
if (string.IsNullOrEmpty(signalRConnectionId) is false)
6060
{
61-
await appHubContext.Clients.Client(signalRConnectionId).SendAsync(SignalREvents.SHOW_MESSAGE, $"Open terms page. {DateTimeOffset.Now:HH:mm:ss}", new { pageUrl = Urls.TermsPage, action = "testAction" }, cancellationToken);
61+
var success = await appHubContext.Clients.Client(signalRConnectionId).InvokeAsync<bool>(SignalREvents.SHOW_MESSAGE, $"Open terms page. {DateTimeOffset.Now:HH:mm:ss}", new { pageUrl = Urls.TermsPage, action = "testAction" }, cancellationToken);
62+
if (success is false) // Client would return false if it's unable to show the message with custom action.
63+
{
64+
await appHubContext.Clients.Client(signalRConnectionId).SendAsync(SignalREvents.SHOW_MESSAGE, $"Simple message. {DateTimeOffset.Now:HH:mm:ss}", null, cancellationToken);
65+
}
6266
}
6367
//#endif
6468

0 commit comments

Comments
 (0)