1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
| using Microsoft.AspNetCore.SignalR;
| using System;
| using System.Collections.Generic;
| using System.Linq;
| using System.Text;
| using System.Threading.Tasks;
|
| namespace IStation.Application
| {
| /// <summary>
| ///
| /// </summary>
| public class StronglyTypedChatHub : Hub<IChatClient>
| {
| /// <summary>
| /// 定义一个方法供客户端调用
| /// </summary>
| public async Task SendMessage(string user, string message)
| {
| // 触发客户端定义监听的方法
| await Clients.All.ReceiveMessage(user, message);
| }
| }
| }
|
|