calling SignalR hub from WebAPI controller issues

前端 未结 1 1951
小蘑菇
小蘑菇 2020-12-05 16:26

I cannot figure out how I can call into a SignalR hub from a WebAPI ApiController. I have put together a sample you can download here that simplifies the problem and demons

相关标签:
1条回答
  • 2020-12-05 16:59

    You are calling different methods on the client:

    API controller

    hubContext.Clients.Group("TestGroup").send("TestGroup", "Called from Controller");
    

    Hub

    Clients.Group(room).newMessage(msg);
    

    The method you want to call is newMessage not send

    chat.client.newMessage = onNewMessage;
    
    0 讨论(0)
提交回复
热议问题