Asp.NetCore+Microsoft.AspNetCore.SignalR前后端分离

 

Asp.NetCore+Microsoft.AspNetCore.SignalR前后端分离

 

Asp.NetCore+Microsoft.AspNetCore.SignalR前后端分离

 

2、安装Microsoft.AspNetCore.SignalR

Asp.NetCore+Microsoft.AspNetCore.SignalR前后端分离

 

3、新建一个集线器和消息类

 

using Microsoft.AspNetCore.SignalR; using System.Threading.Tasks; namespace WebApi.Chat { public class ChatHub : Hub { //SendMsg用于前端调用 public Task SendMsg(ChatMessageInfo info) { //在客户端实现此处的Show方法 return Clients.All.SendAsync("Show", info.UserName + ":" + info.Message); } } }

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wppsfx.html