[英]ICallbackEventHandler request every 1 second
I have code that fires an ICallbackEventHandler every 1000ms. 我有代码,每1000毫秒触发一次ICallbackEventHandler。 When I run this code locally the data responds quick like every 1 second.
当我在本地运行此代码时,数据会像每1秒一样快速响应。
I then uploaded this on the server and sometimes the data responds 1 second and sometimes 3 seconds and then sometimes 6-7 seconds, why is this? 然后,我将其上传到服务器上,有时数据响应1秒,有时3秒,有时6-7秒,这是为什么?
The bit of code that makes this recursive call every 1 second to the server is below: 下面是每1秒对服务器进行一次此递归调用的代码位:
function MessageServerResponse(param, context) {
if (param.length > 0) {
var splitParam = param.split("~");
var id = splitParam[0];
var data= splitParam[1];
$('#' + id).prepend(data);
}
setTimeout("MessageServerRequest();", 1000);
}
if ur the only person who use server, the response would be always 1 second. 如果您是唯一使用服务器的人,则响应将始终为1秒。 and u cannot expect client to dedicately response your script
而且您不能指望客户端专门响应您的脚本
1 of my trick to make it faster 我的技巧之一,使其更快
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.