Search code examples
javascriptopentoktokbox

OpenTok JS connection timeout issue while loading resources


I'm using opentok client JS api, to set up a video conferencing app. Intermittently, the js and css resources from open tok servers fail to load.

These are the errors I'm seeing on developer console in Chrome Browser. I have a good internet connection and it's not always. I think, these resources are being loaded from opentok.min.js. I have that file as local resource. Is there way to avoid such issues ?

http://static.opentok.com/webrtc/v2.2.9.6/js/dynamic_config.min.js Failed to load resource: net::ERR_CONNECTION_TIMED_OUT

http://static.opentok.com/webrtc/v2.2.9.6/css/ot.min.css Failed to load resource: net::ERR_CONNECTION_TIMED_OUT

Once this happens, I'll not be able to see other party's video. Any help is appreciated ? What is the best practice to avoid this issue in a production environment ?


Solution

  • I think you are running into some intermittent network connectivity issues. You mentioned:

    I have a good internet connection and it's not always

    Which I understood to mean that you don't always get the errors.

    This is what I believe is happening: because you have the opentok.min.js file downloaded locally, you are able to obtain this resource every single time; even when your network connectivity is down. However, this file also obtains other files that are hosted on TokBox servers dynamically. Namely, the dynamic_config.min.js and ot.min.css files. When those resources are requested and are not able to be obtained, you get the network timeout error.

    As for best practices, TokBox recommends that you not locally download the OpenTok.min.js file, but instead use:

    <script src='//static.opentok.com/webrtc/v2.2/js/opentok.min.js'></script>
    

    This won't solve the problem if it is in fact due to network issues, but it will fail fast for your debugging purposes.