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.
89 lines
3.5 KiB
89 lines
3.5 KiB
//using Application.Models;
|
|
//using Infrastructure.Extensions;
|
|
//using Microsoft.AspNetCore.SignalR;
|
|
//using System;
|
|
//using System.Threading.Tasks;
|
|
|
|
//namespace IoTShared
|
|
//{
|
|
// public class PageHub : Hub
|
|
// {
|
|
// private readonly INodeService _nodeService;
|
|
|
|
// public PageHub(
|
|
// INodeService nodeService)
|
|
// {
|
|
// this._nodeService = nodeService;
|
|
// this._nodeService.IsCallback = true;
|
|
// }
|
|
|
|
// public override Task OnConnectedAsync()
|
|
// {
|
|
// Console.WriteLine($"{Context.ConnectionId} has connected which request url is {Context.GetHttpContext().Request.GetUrl()}");
|
|
// this.Groups.AddToGroupAsync(Context.ConnectionId, Context.ConnectionId);
|
|
// if (Context.GetHttpContext().Request.Query.Keys.Contains("group"))
|
|
// {
|
|
// this.Groups.AddToGroupAsync(Context.ConnectionId, Context.GetHttpContext().Request.Query["group"]);
|
|
// }
|
|
// this.Clients.Group(Context.ConnectionId).SendAsync("Connected", Context.ConnectionId);
|
|
// return base.OnConnectedAsync();
|
|
// }
|
|
|
|
// public override Task OnDisconnectedAsync(Exception exception)
|
|
// {
|
|
// Console.WriteLine($"{Context.ConnectionId} has disconnected which request url is {Context.GetHttpContext().Request.GetUrl()}");
|
|
// return base.OnDisconnectedAsync(exception);
|
|
// }
|
|
|
|
// public Task Send(string group, string method, string message)
|
|
// {
|
|
// Console.WriteLine($"PageHub>Send {message} To {group}.{message}");
|
|
// return Clients.Group(group).SendAsync(method, message);
|
|
// }
|
|
|
|
// public Task UpdateCallBack(string method, string message)
|
|
// {
|
|
// if (method == nameof(INodeService.EditNode))
|
|
// {
|
|
// this._nodeService.EditNode(message.FromJson<EditNodeModel>());
|
|
// }
|
|
// else if (method == nameof(INodeService.DeleteNode))
|
|
// {
|
|
// this._nodeService.DeleteNode(message.FromJson<Guid>());
|
|
// }
|
|
// else if (method == nameof(INodeService.CreateSence))
|
|
// {
|
|
// this._nodeService.CreateSence(message.FromJson<EditSenceModel>());
|
|
// }
|
|
// else if (method == nameof(INodeService.EditSence))
|
|
// {
|
|
// this._nodeService.EditSence(message.FromJson<EditSenceModel>());
|
|
// }
|
|
// else if (method == nameof(INodeService.DeleteSence))
|
|
// {
|
|
// this._nodeService.DeleteSence(message.FromJson<Guid>());
|
|
// }
|
|
// else if (method == nameof(INodeService.EditDevice))
|
|
// {
|
|
// this._nodeService.EditDevice(message.FromJson<EditDeviceModel>());
|
|
// }
|
|
// else if (method == nameof(INodeService.DeleteDevice))
|
|
// {
|
|
// this._nodeService.DeleteDevice(message.FromJson<Guid>());
|
|
// }
|
|
// else if (method == nameof(INodeService.CreateCommand))
|
|
// {
|
|
// this._nodeService.CreateCommand(message.FromJson<EditCommandModel>());
|
|
// }
|
|
// else if (method == nameof(INodeService.EditCommand))
|
|
// {
|
|
// this._nodeService.EditCommand(message.FromJson<EditCommandModel>());
|
|
// }
|
|
// else if (method == nameof(INodeService.DeleteCommand))
|
|
// {
|
|
// this._nodeService.DeleteCommand(message.FromJson<Guid>());
|
|
// }
|
|
// return Task.CompletedTask;
|
|
// }
|
|
// }
|
|
//} |