-
AuthorPosts
-
September 5, 2014 at 5:01 pm #99551
Hi there,
I replicated your issue. Seems like this happens on request with Provisional headers are shown. Like in chrome browser. Which getting halted and visual composer keeps on requesting this request.
There is one fix, but not 100% working because ajax is asynchronous which keeps requesting connection without checking the status of the other.
For this, I just turned off asynchronous connection a bit slow but no more connection lost.
Add this code at your child theme’s functions.php
add_action('admin_footer', function(){ $user_page = get_current_screen(); if( $user_page->post_type == 'post' || $user_page->post_type == 'page' ) { ?> <script type="text/javascript"> jQuery.ajaxSetup({ async: false }); </script> <?php } });
This works on me too and better than above :
add_action('admin_head', function(){ $user_page = get_current_screen(); if( $user_page->post_type == 'post' || $user_page->post_type == 'page' ) { ?> <script type="text/javascript"> jQuery.ajaxSetup({ beforeSend : function(xhr, setting) { if( setting.data == 'action=wpb_single_image_src' || setting.data == 'action=heartbeat') { xhr.abort(); return false; } } }); </script> <?php } });
Thanks!
September 5, 2014 at 5:28 pm #99573Thank you for the code. The first code fixed the connection lost error message, however, now I cannot edit any text in WordPress, and I mean ANY. I first thought that maybe the page was stuck, so I clicked on Add New Page. I couldn’t even type any text. Usually when you click a field in WordPress, you can see a blinking cursor, that cursor does not show and you can’t type anything in any field.
I am going to try the second code now.
Actually I can’t, because the first code won’t let me type anything as described above. I will try logging out and logging back in now.
Ok, so I was able to log back in with no issues, however, I think the first code set changed something major because any link I click in WP causes my server to return a 500 error!
September 5, 2014 at 6:07 pm #99602Hi there,
You just need to remove added code. And should be added under child theme’s functions.php so once removed it will back to how it was.
The code is php, but the javascript fix will only run on browser and not from server. If you’re having 500 error then it could be that you pasted the code partially , or removed the code leaving some extra lines of code behind. This is common mistake in which always happen. Please paste it exactly as given, and remove it just like you pasted.
Please provide your child theme’s functions.php code so I could point what went wrong.
Thanks!
September 5, 2014 at 10:09 pm #99675Thank you, yes it was a pasting error in the code, so we got the site back up, no problem.
The first set of code in post# 99551 definitely stopped the Connection Lost error message. However, as the first author of that post said, Visual Composer ran super slow. So we decided to use the second code set by the other author, and…it’s brilliant. Not only did it handle 10842 words of shortcode in Visual Composer, it also magically made editing in Visual Composer run very fast (once all 10842 words were loaded in the browser). Whoever the second author is, my hat’s off to you. Not to take anything away from the author of the first set of code (I would not have thought about the asynchronous state in ajax), which is also brilliant.
These test results were obtained in a local host environment with only 128MB allocated for PHP. We tried this same set of codes supplied by the authors above (along with the same set of pages on our local server) on our hosted server and…it failed. So, based on a collective, extensive effort between our team and the team at Themeco, we have determined that our hosted server cannot handle development in WordPress using Visual Composer…Even though those servers are supposedly with SSDs AND after we had them allocate 512MB for PHP. I happened to take a snapshot of the CPU usage of the hosted server at it showed it at 100%, so it looks like they’re throttling it.
Thank you support team at Themeco (or Theme.co, whichever you prefer). We have, through your tremendous amount of help, found a fix for this issue (at least locally) and determined that we need to fire our hosting company…or at least force them to increase the CPU allocation.
Thanks again. Now I can celebrate my wedding anniversary over this weekend without this problem in my head.
September 5, 2014 at 11:10 pm #99699Great to hear that second fix works on you too! I did the first fix and works, though quite slow on me. So, instead I created another fix which blocks unnecessary connections
Enjoy your wedding 🙂
You’re always welcome.
-
AuthorPosts