示例#1
0
        public async Task ClientSendOutput(ClientSendOutputArguments args)
        {
            await HubOperation(nameof(ClientSendCommand), args, async() =>
            {
                ProcessSession session = sessionManager.GetSession(args.SessionId);
                var user = Context.User;

                if (session.CanSendCommands(user.GetUserId()))
                {
                    await Clients.GroupExcept(session.GroupName, Context.ConnectionId).SendAsync("AddMessage", args.Output);
                }
            });
        }
示例#2
0
        public async Task ClientSendCommand(ExecuteProcessCommandArguments args)
        {
            await HubOperation(nameof(ClientSendCommand), args, async() =>
            {
                ProcessSession session = sessionManager.GetSession(args.SessionId);
                var user = Context.User;

                if (session.CanSendCommands(user.GetUserId()))
                {
                    await Clients.GroupExcept(session.GroupName, Context.ConnectionId).SendAsync("AddMessage", args.Command);
                    var workerContext = GetWorkerContext(session.WorkerConnection);
                    await workerContext.ExecuteProcessCommand(args);
                }
            });
        }