-
Notifications
You must be signed in to change notification settings - Fork 385
Add ClientManager
usage to management sample
#167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
cc6b7e2
642a087
ffdbd28
978013b
cf03759
6421eb1
8630742
bc3e7e3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Runtime.CompilerServices; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.SignalR.Client; | ||
using Microsoft.Extensions.CommandLineUtils; | ||
|
@@ -15,7 +14,7 @@ class Program | |
{ | ||
private const string MessageHubEndpoint = "http://localhost:5000/Message"; | ||
private const string Target = "Target"; | ||
private const string DefaultUser = "User"; | ||
private const string DefaultUser = "TestUser"; | ||
|
||
static void Main(string[] args) | ||
{ | ||
|
@@ -37,7 +36,10 @@ static void Main(string[] args) | |
await Task.WhenAll(from conn in connections | ||
select conn.StartAsync()); | ||
|
||
Console.WriteLine($"{connections.Count} Client(s) started..."); | ||
foreach (var (connection, userId) in connections.Zip(userIds)) | ||
{ | ||
Console.WriteLine($"User '{userId}' with connection id '{connection.ConnectionId}' connected."); | ||
} | ||
Console.ReadLine(); | ||
|
||
await Task.WhenAll(from conn in connections | ||
|
@@ -59,8 +61,14 @@ static HubConnection CreateHubConnection(string hubEndpoint, string userId) | |
|
||
connection.Closed += ex => | ||
{ | ||
Console.WriteLine(ex); | ||
return Task.FromResult(0); | ||
Console.Write($"The connection of '{userId}' is closed."); | ||
//If you expect non-null exception, you need to turn on 'EnableDetailedErrors' option during client negotiation. | ||
if (ex != null) | ||
{ | ||
Console.Write($" Exception: {ex}"); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how about simply turn on it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the |
||
Console.WriteLine(); | ||
return Task.CompletedTask; | ||
}; | ||
|
||
return connection; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about make it in format
so that reader can easily get the note