Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 信号器MVC在用户处于非活动状态时向其发出警报_Asp.net Mvc_Signalr - Fatal编程技术网

Asp.net mvc 信号器MVC在用户处于非活动状态时向其发出警报

Asp.net mvc 信号器MVC在用户处于非活动状态时向其发出警报,asp.net-mvc,signalr,Asp.net Mvc,Signalr,我有一个客户要求MVC应用程序在用户处于非活动状态58分钟时弹出一个窗口。 他们说,由于未知的原因,这必须在信号机中完成。(现有项目中没有信号机,我必须加入nuget软件包) 我通常使用信号器向多个用户发送消息。 你会怎么做 记录用户已触发控制器操作 记录用户处于非活动状态的时间 发送一条消息说他们已经 仅对一个用户处于非活动状态 我通常会在简单的jQuery中这样做 var idleTime = 0; function resetAreYouStillThereCounter() {

我有一个客户要求MVC应用程序在用户处于非活动状态58分钟时弹出一个窗口。 他们说,由于未知的原因,这必须在信号机中完成。(现有项目中没有信号机,我必须加入nuget软件包)

我通常使用信号器向多个用户发送消息。
你会怎么做

  • 记录用户已触发控制器操作
  • 记录用户处于非活动状态的时间
  • 发送一条消息说他们已经 仅对一个用户处于非活动状态
我通常会在简单的jQuery中这样做

 var idleTime = 0;
 function resetAreYouStillThereCounter() {
    idleTime = 0;
}

$(document).ready(function () {
    $(document).ready(function () {
        //Increment the idle time counter every minute.
        setInterval(timerIncrement, 60000); // 1 minute

    //Zero the idle timer on mouse movement.
    $(this).mousemove(function (e) {
        resetAreYouStillThereCounter();
    });
    $(this).keypress(function (e) {
        resetAreYouStillThereCounter();
    });
});

function timerIncrement() {
    idleTime = idleTime + 1;

    //If were on the Login page reset the counter
    if (top.location.pathname == "/Authentication/Login") {
        resetAreYouStillThereCounter();
    }

    if (idleTime > 57) { // 57 minutes
        alert("Hi, you still here?")
    }
}
});