I have successfully integrated SignalR.AspNetCore into my AbpZero template. everything works fine. However when I tried to add a hub into my application like what has been described in the document, I am getting the following error on
public async Task SendMessage(string message)
{
await Clients.All.InvokeAsync("getMessage", string.Format("User {0}: {1}", AbpSession.UserId, message));
}
Error CS1061 'IClientProxy' does not contain a definition for 'InvokeAsync' and no extension method 'InvokeAsync' accepting a first argument of type 'IClientProxy' could be found (are you missing a using directive or an assembly reference?)
So to configure SignalR in our project, we need to add signalR service to ConfigureService method of startup class. Also we need to configure the route to signalR hubs using UseSignalR method defined in configure method of startup class. This method(app. UseSignalR) adds SignalR to a middleware pipeline.
SignalR Hubs are a way to logically group connections as documented. Take an example of a chat application. A group of users could be part of the same hub which allows for sending messages between users in the group. The hubName here can be any string which is used to scope messages being sent between clients.
SignalR is an asynchronous signaling library for ASP.NET that our team is working on to help build real-time multi-user web application.
Using SendAsync() worked for me. I am using this package:
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.0.0-preview2-30138" />
The reason I am using it is because when I added the new client to my Angular project, that is the package npm served. The packages have to match at this time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With