Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public async Task WebSocketsWorks()
});
connectionBuilder.Services.AddLogging();
connectionBuilder.Services.AddSingleton(LoggerFactory);
var connection = connectionBuilder.Build();
await using var connection = connectionBuilder.Build();
Copy link

Copilot AI Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using await using for connection disposal is correct, but ensure that the connection is explicitly stopped before disposal to prevent potential race conditions. Consider calling await connection.StopAsync() before the connection goes out of scope.

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DisposeAsync does the same thing as StopAsync for the HubConnection.


var originalMessage = "message";
connection.On<string>("Echo", (receivedMessage) =>
Expand Down Expand Up @@ -118,7 +118,7 @@ public async Task LongPollingWorks()
});
connectionBuilder.Services.AddLogging();
connectionBuilder.Services.AddSingleton(LoggerFactory);
var connection = connectionBuilder.Build();
await using var connection = connectionBuilder.Build();
Copy link

Copilot AI Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using await using for connection disposal is correct, but ensure that the connection is explicitly stopped before disposal to prevent potential race conditions. Consider calling await connection.StopAsync() before the connection goes out of scope.

Copilot uses AI. Check for mistakes.

var originalMessage = "message";
connection.On<string>("Echo", (receivedMessage) =>
Expand Down
Loading