Skip to content

Conversation

Y-Sindo
Copy link
Contributor

@Y-Sindo Y-Sindo commented Sep 8, 2021

SignalR client output sample:

User 'User' with connection id 'CKZhiNk__nyv3Vrz8SnK_Q1448c44c1' connected.
User: gets message from service: 'aaa'

MessagePublisher output sample:

*********Usage*********
send user <UserId> <Message>
send users <User1,User2,...> <Message>
send group <GroupName> <Message>
send groups <Group1,Group2,...> <Message>
usergroup add <User1,User2,...> <GroupName>
usergroup remove <UserId> <GroupName>
broadcast <Message>
close <ConnectionID> <Reason>?
checkexist connection <ConnectionID>
checkexist user <UserID>
checkexist group <GroupName>
***********************
> checkexist connection CKZhiNk__nyv3Vrz8SnK_Q1448c44c1
connection 'CKZhiNk__nyv3Vrz8SnK_Q1448c44c1' exists.
> checkexist connection CKZhiNk__nyv3Vrz8SnK_Q1448c44c2
connection 'CKZhiNk__nyv3Vrz8SnK_Q1448c44c2' does not exist.
> checkexist user User
user 'User' exists.
> send user User abc
send message 'abc' to 'User'

SignalR client output sample:

```
User 'User' with connection id 'CKZhiNk__nyv3Vrz8SnK_Q1448c44c1' connected.
User: gets message from service: 'aaa'
```
MessagePublisher output sample:
```
*********Usage*********
send user <User Id> <Message>
send users <User Id List (Seperated by ',')> <Message>
send group <Group Name> <Message>
send groups <Group List (Seperated by ',')> <Message>
usergroup add <User Id> <Group Name>
usergroup remove <User Id> <Group Name>
broadcast <Message>
close <Connection ID> <Reason>
checkexist connection <Connection ID>
checkexist user <User ID>
checkexist group <Group Name>
***********************
> checkexist connection CKZhiNk__nyv3Vrz8SnK_Q1448c44c1
connection 'CKZhiNk__nyv3Vrz8SnK_Q1448c44c1' exists.
> checkexist connection CKZhiNk__nyv3Vrz8SnK_Q1448c44c2
connection 'CKZhiNk__nyv3Vrz8SnK_Q1448c44c2' does not exist.
> checkexist user User
user 'User' exists.
> send user User abc
send message 'abc' to 'User'
```
@Y-Sindo Y-Sindo changed the title zityang/management Add ClientManager usage to management sample Sep 8, 2021
if (ex == null)
{
Console.WriteLine("If you expect non-null exception, you need to turn on 'EnableDetailedErrors' option during client negotiation.");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

how about simply turn on it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

EnableDetailedErrors is not recommended by SignalR, so I don't turn on it by default.

Copy link
Contributor

@wanlwanl wanlwanl Sep 16, 2021

Choose a reason for hiding this comment

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

I think the If you expect non-null exception, you need to turn on is wierd here, how about making EnableDetailedErrors an option when you start negotiation server?

});
```
`EnableDetailedErrors` defaults to false because these exception messages can contain sensitive information.
## Full Sample
Copy link
Contributor

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

EnableDetailedErrors defaults to false because these exception messages can contain sensitive information.

so that reader can easily get the note

else if (args.Length == 3 && args[0] == "checkexist")
{
var exist = await publisher.CheckExist(args[1].ToLowerInvariant(), args[2]);
Console.WriteLine(exist ? $"{args[1]} '{args[2]}' exists." : $"{args[1]} '{args[2]}' does not exist.");
Copy link
Contributor

@wanlwanl wanlwanl Sep 16, 2021

Choose a reason for hiding this comment

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

WriteLine

simply reply exist/not exist is enough, since the connection id is too long and random and distract reader...

else if (args.Length == 2 && args[0] == "close")
{
await publisher.CloseConnection(args[1], null);
Console.WriteLine($"Close connection '{args[1]}'.");
Copy link
Contributor

Choose a reason for hiding this comment

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

WriteLine

how about closed.
and what if passing a non-existed connection id?

Copy link
Contributor

@wanlwanl wanlwanl left a comment

Choose a reason for hiding this comment

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

:shipit:

@Y-Sindo Y-Sindo merged commit d18d9b3 into aspnet:main Sep 17, 2021
@Y-Sindo Y-Sindo deleted the zityang/management branch September 17, 2021 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants