You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.1 KiB
36 lines
1.1 KiB
using System;
|
|
using Infrastructure.Web.SignalR;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.SignalR;
|
|
|
|
namespace ApiGateway.Controllers
|
|
{
|
|
public class HomeController : Controller
|
|
{
|
|
private readonly IHubContext<PageHub> _pageHubContext;
|
|
|
|
public HomeController(IHubContext<PageHub> 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("");
|
|
}
|
|
}
|
|
} |