I cannot debug this message, which appeared like a week ago.
I tried to restore old files, but this is strange, nothing solves my problem.
So: I have two long polling requests. (disabling one of them 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->name = get_dollar_name($v->from_user);
$v->avatar = get_avatar($v->from_user, 50);
}
$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;
}
As you can see, I sent cache control headers, so this should not be the problem described here
. I also do not have adBlocker installed, and this is a local installation.
there is a client side script
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++){
if(quick_chat.privateOpen == true && (quick_chat.privateOhter == updates[i].from_user || quick_chat.privateOhter == updates[i].to_user )) {
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) {
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;
}
}
}
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'
);
}
This is normal? I cannot be a normal message for lengthy polls - from its pending request. Its just not documented anywhere
:
, , 6 , - , ( ), .
script , :
http://www.techytalk.info/wordpress/quick-chat/
: ? ( , ), - , ? , , , , ( script)