问题描述
我不能调试这个消息这似乎像一个星期前。
I cant debug this message which appeared like a week ago.
我想恢复到旧的文件,但是这是奇怪的,没有解决我的问题。
I tried restoring to old files but this is odd, nothing solves my problem.
所以:我有两个长轮询请求。 (把他们的一关没有帮助)。
So: I have two long polling requests. (turning one of them off does not help).
例如,这是其中的一个:
for example this is one of them:
public function update_private_messages_ajax_handler(){
global $wpdb;
global $bp;
$chat_table = $wpdb->prefix . 'bp_dollars_chat';
$current_user = $bp->loggedin_user->id;
ob_start();
header("Content-Type: application/json");
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
$startTime = time();
while((time()-$startTime)<=20) {
$messages = $wpdb->get_results(
$wpdb->prepare("(SELECT *
FROM $chat_table
WHERE to_user = %d
AND recd = 1
AND id > %d
ORDER BY id DESC) ORDER BY id ASC
", $current_user, $_POST['last_id'])
);
if($messages) {
foreach($messages as $v){
//$v->timestring = date_i18n($this->date_format.' - '.$this->time_format, $v->unix_timestamp+$this->gmt_offset);
$v->name = get_dollar_name($v->from_user);
$v->avatar = get_avatar($v->from_user, 50);
//$v->message = convert_smilies( $v->message );
}
$response = json_encode(array('no_participation' => $this->no_participation, 'success'=> 1, 'messages'=>$messages));
echo $response;
ob_flush(); flush();
exit;
} else {
sleep($this->options['timeout_refresh_messages']);
}
}
$response = json_encode(array('no_participation' => $this->no_participation, 'success'=> 0));
echo $response;
ob_flush(); flush();
exit;
}
正如你所看到的,我送缓存控制头,所以这不应该成为问题的described这里我也不要安装任何adBlocker,这是本地安装。
As you can see, I sent cache-control headers, so this should not be problem described hereI also dont have any adBlocker installed and this is local installation.
有一个客户端脚本
update_private_messages: function() {
jQuery.post(quick_chat.ajaxurl, {
action: 'quick-chat-ajax-update-pmessages',
last_id: quick_chat.last_private_id
},
function(data) {
console.log(data);
if(data.success == 1) {
var updates = data.messages;
var already_notified = 0;
var chat_history = jQuery('.popoverx.chat.in .chathistory');
for(var i=0;typeof(updates[i])!='undefined';i++){
// this in case if window open and new message is for current user
if(quick_chat.privateOpen == true && (quick_chat.privateOhter == updates[i].from_user || quick_chat.privateOhter == updates[i].to_user )) {
// @TODO do I animate every time?
jQuery(chat_history).prepend(quick_chat.single_private_html(updates[i])).animate({scrollTop: 0}, 500);
} else if(updates[i].recd == 1 && updates[i].from_user != quick_chat.user_id) {
// not yet in unread group
if(quick_chat.privateUnread.indexOf(parseInt(updates[i].from_user)) == -1) {
quick_chat.privateUnread.push(parseInt(updates[i].from_user));
}
if(already_notified == 0 && quick_chat.last_private_id != 0 && updates[i].from_user != quick_chat.user_id) {
if(quick_chat.play_audio == 1) {
quick_chat.audio_element.play();
}
already_notified = 1;
}
}
}
// update label
var unreadIcon = jQuery('#bs-navbar-right > li > a.messages');
if(quick_chat.privateUnread.length != 0) {
unreadIcon.find('span').remove().end().append('<span class="label label-danger">'+ quick_chat.privateUnread.length +'</span>')
} else {
unreadIcon.find('span').remove()
}
quick_chat.last_private_id = updates[updates.length-1].id;
}
quick_chat.update_private_messages();
}, 'json'
);
}
这是正常的吗?我不能对长轮询正常的消息 - 因为它的暂停请求。它只是似乎并没有被记录任何地方
Is this normal? I cant be normal message for long polling - since its a pending request.Its just does not seem to be documented anywhere
请注意:我也有很多短期的投票请求,这可能是情况下,更多的则6请求相互抵消,但 - 我也试过打开所有其他的请求了,除了一个(长轮询),这不是个例
Note:also I have many short-polling requests and this could be case where more then 6 requests cancel each other but - I also tried turning all other requests off, except one (long polling) and this is not a case
下面是一个原始的剧本工作,所以你可以看到的消息: http://www.techytalk.info/word$p$pss/quick-聊天/
Here is a original script working so you can see the message:http://www.techytalk.info/wordpress/quick-chat/
只是为了summirize这样一个问题:这是正常的吗? (我没有看到其他网站上这个问题,在彗星时) - 如果不是 - 我应该在哪里寻找问题,客户方或服务器端? Here他们说,在这种情况下请求没有在所有发送的,但那不是真实的,我的脚本工作,我不能聊天(这是一个聊天脚本)
Just to summirize this question: Is this normal? (I don't see this problem on other sites where comet is used) - and if not - Where should I seek for problem, clientside or server-side? Here they say that in such case request is not sent at all, but thats not true, my scripts are working and I cant chat (this is a chat script)
推荐答案
这是在Chrome完全正常(如最近)。有一个讨论这里,他们讨论的变化,从根本上对未决的请求它显示出一定的标题不正确,所以现在他们显示一个警告,这些都是临时的标题。
This is completely normal in chrome (as of recently). There was a discussion here where they discuss the change, essentially on pending requests it was showing certain headers incorrectly, so now they show a warning that these are provisional headers.
从讨论:
网络面板:加谨慎关于临时请求头。 (是:在开发工具,请求头待处理的请求是不正确的)
我不知道什么时候该修补程序实际上得到释放,或者如果你离开浏览器打开所有的时间等了一段时间没更新 - 但几乎可以肯定它是什么你做 - 浏览器是如何工作的吧。
I don't know when the fix actually got released, or if you leave Chrome open all the time and so it didn't update for a while - but almost certainly it is nothing you did - just how Chrome works now.
这篇关于注意:临时标题显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!