using System; using Infrastructure.Web.SignalR; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.SignalR; namespace ApiGateway.Controllers { public class HomeController : Controller { private readonly IHubContext _pageHubContext; public HomeController(IHubContext pageHubContext) { this._pageHubContext = pageHubContext; } public IActionResult Index() { return View(); } public IActionResult Test(string id = "id1", string name = "智慧教室", string message = "节点数据信息节点数据信息节点数据信息节点数据信息节点数据信息节点数据信息节点数据信息") { this._pageHubContext.Clients.All.SendAsync("receive", new { groupId = id, groupName = name, user = "管理员", message = message, timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds(), read = false }); return Content(""); } } }