Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AspNetCore.SignalR: 'IClientProxy' does not contain a definition for 'InvokeAsync'

Tags:

signalr-hub

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?)

like image 314
Mohammad Shadmehr Avatar asked Feb 19 '18 23:02

Mohammad Shadmehr


People also ask

How do I add a SignalR to my pipeline?

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.

What is hubName in SignalR?

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.

Is SignalR asynchronous?

SignalR is an asynchronous signaling library for ASP.NET that our team is working on to help build real-time multi-user web application.


1 Answers

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.

like image 106
Lryd Avatar answered Oct 15 '22 13:10

Lryd