I've got a browser game and I have recently started adding audio to the game.
Chrome does not load the whole page and gets stuck at "91 requests | 8.1 MB transferred"
and does not load any more content; and it even breaks the website in all other tabs, saying Waiting for available socket
.
After 5 mins (exactly) the data are loaded.
This does not happen on any other browser.
Removing one MP3 file (the latest added one) fixed the problem, so is it perhaps a data limit problem?
To flush the socket pools, go to chrome://net-internals/#sockets and click Flush socket pools. If you are already on the DNS page, just select Sockets in the left hand column. Usually you don't need to worry about flushing the socket pools.
The cache is that place where your internet browser, in this case, Google Chrome, stores certain information about your browsing activity so it can access regularly used websites quicker. The waiting for cache error you see on your laptop or computer occurs when Chrome is unable to access this information.
What is net-internals? Per the Chromium Project, Net-internals is a “visualizer for the NetLog event stream. It can be used both in real-time, and also to load up post-mortem NetLog dumps.” Essentially, it's a real time look at network data, allowing you to download logs and see visuals of network data.
Explanation:
This problem occurs because Chrome allows up to 6 open connections by default. So if you're streaming multiple media files simultaneously from 6 <video>
or <audio>
tags, the 7th connection (for example, an image) will just hang, until one of the sockets opens up. Usually, an open connection will close after 5 minutes of inactivity, and that's why you're seeing your .pngs finally loading at that point.
Solution 1:
You can avoid this by minimizing the number of media tags that keep an open connection. And if you need to have more than 6, make sure that you load them last, or that they don't have attributes like preload="auto"
.
Solution 2:
If you're trying to use multiple sound effects for a web game, you could use the Web Audio API. Or to simplify things, just use a library like SoundJS, which is a great tool for playing a large amount of sound effects / music tracks simultaneously.
Solution 3: Force-open Sockets (Not recommended)
If you must, you can force-open the sockets in your browser (In Chrome only):
chrome://net-internals
.Sockets
from the menu.Flush socket pools
button.This solution is not recommended because you shouldn't expect your visitors to follow these instructions to be able to view your site.
Looks like you are hitting the limit on connections per server. I see you are loading a lot of static files and my advice is to separate them on subdomains and serve them directly with Nginx for example.
Create a subdomain called img.yoursite.com and load all your images from there.
Create a subdomain called scripts.yourdomain.com and load all your JS and CSS files from there.
Create a subdomain called sounds.yoursite.com and load all your MP3s from there... etc..
Nginx has great options for directly serving static files and managing the static files caching.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With