-
Notifications
You must be signed in to change notification settings - Fork 159
SignalR Hub Example Update to 7 plus add Hub Client Results #138
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
base: main
Are you sure you want to change the base?
Conversation
Could you help me with the 3 Client Results hub classes for our standard hubs SingalRChat sample? The 3 Client Results hub samples are here in this PR:
Sorry to ask, I have been trying to work out the intent of how client results work but I'm not up to speed enough on SignalR to pull it off. |
signalr/hubs/samples/7.x/SignalRHubsSample/Snippets/Hubs/ChatHubClientResultsStronglyTyped.cs
Outdated
Show resolved
Hide resolved
// <snippet_HubClientResultsStronglyTyped> | ||
public interface IClient | ||
{ | ||
Task<string> GetMessage(); |
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.
I think this needs to take a CancellationToken
parameter.
// <snippet_HubClientReturnContext> | ||
public class ChatHubClientResultsContext : Hub | ||
{ | ||
async Task SomeMethod(IHubContext<ChatHubClientResultsContext> context) |
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.
This is an odd way to use IHubContext
. It's probably better from a controller or minimal api:
https://learn.microsoft.com/aspnet/core/signalr/hubcontext?view=aspnetcore-7.0#inject-an-instance-of-ihubcontext-in-a-controller
.withUrl("/chat") | ||
.build(); | ||
|
||
connection.on("ReceiveMessage", (user, message) => { |
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.
If the intent is to have a runnable app, we'll need to add javascript code for the client results
https://learn.microsoft.com/aspnet/core/signalr/hubs?view=aspnetcore-7.0#typescript-client
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.
@BrennanConroy, sorry, I should have been more clear. I just took your code that was inline from the doc. I was hoping you could create runnable versions of them so we have one runnable sample somewhere. I do not have enough experience with SignalR to make your original samples work. Sorry for the confusion.
closing and reopening to run checks again |
@wadepickett can you update this for .NET 9? |
Make that .NET 10? |
------ Collaborative Work In Progress while in draft ------
Contributes to
Changes from existing 6.x version: