| | |
| | | { |
| | | private readonly IHttpContextAccessor _httpContextAccessor; |
| | | private readonly IRouterExtension _routerExtension; |
| | | private readonly WebSocketServer _webSocketServer; |
| | | //private readonly WebSocketServer _webSocketServer; |
| | | |
| | | public TaskController(ITaskService service, IHttpContextAccessor httpContextAccessor, IRouterExtension routerExtension, WebSocketServer webSocketServer) : base(service) |
| | | public TaskController(ITaskService service, IHttpContextAccessor httpContextAccessor, IRouterExtension routerExtension/*, WebSocketServer webSocketServer*/) : base(service) |
| | | { |
| | | _httpContextAccessor = httpContextAccessor; |
| | | _routerExtension = routerExtension; |
| | | _webSocketServer = webSocketServer; |
| | | //_webSocketServer = webSocketServer; |
| | | } |
| | | |
| | | [HttpPost, Route("ReceiveTask"), AllowAnonymous] |
| | |
| | | return WebResponseContent.Instance.OK(data: _routerExtension.GetEndPoint(startPoint, routeType)); |
| | | } |
| | | |
| | | [HttpPost, HttpGet, Route("WebSocketPushMessage"), AllowAnonymous] |
| | | public WebResponseContent WebSocketPushMessage(string message) |
| | | { |
| | | try |
| | | { |
| | | _webSocketServer.PublishAllClientPayload(message); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch(Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | //[HttpPost, HttpGet, Route("WebSocketPushMessage"), AllowAnonymous] |
| | | //public WebResponseContent WebSocketPushMessage(string message) |
| | | //{ |
| | | // try |
| | | // { |
| | | // _webSocketServer.PublishAllClientPayload(message); |
| | | // return WebResponseContent.Instance.OK(); |
| | | // } |
| | | // catch(Exception ex) |
| | | // { |
| | | // return WebResponseContent.Instance.Error(ex.Message); |
| | | // } |
| | | //} |
| | | } |
| | | } |