终端一体化运控平台
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.

PersonHub.cs 902 B

2 years ago
2 years ago
2 years ago
2 years ago
12345678910111213141516171819202122232425262728293031323334
  1. using Microsoft.AspNetCore.SignalR;
  2. namespace BPASmartClient.AgvApi
  3. {
  4. public class PersonHub : Hub
  5. {
  6. public override Task OnConnectedAsync()
  7. {
  8. Console.WriteLine($"{Context.ConnectionId}:= 连接成功");
  9. Factory.GetInstance.HubCallerClient = Clients;
  10. return base.OnConnectedAsync();
  11. }
  12. public override Task OnDisconnectedAsync(Exception? exception)
  13. {
  14. Console.WriteLine($"{Context.ConnectionId}:= 断开连接");
  15. return base.OnDisconnectedAsync(exception);
  16. }
  17. /// <summary>
  18. /// 接收客户端发来的信息,并向客户端发送信息
  19. /// </summary>
  20. /// <param name="str"></param>
  21. /// <returns></returns>
  22. public Task Send(object str)
  23. {
  24. return Clients.Caller.SendAsync("SendMessage", str);
  25. }
  26. }
  27. }