# Delay in WebSocket connection

**URL:** <https://devforum.zoom.us/t/delay-in-websocket-connection/69756>\
**Category:** Web\
**Created:** [May 31, 2022, 3:07pm UTC](https://devforum.zoom.us/t/delay-in-websocket-connection/69756 "2022-05-31T15:07:00Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![shoaib](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shoaib/32/28580_2.png) [@shoaib](https://devforum.zoom.us/u/shoaib)\
**Post date:** [May 31, 2022, 3:07pm UTC](https://devforum.zoom.us/t/delay-in-websocket-connection/69756/1 "2022-05-31T15:07:00Z")

</div>

Hey @tommy and @vic.yang ,  
Sometimes while joining Zoom Session, Zoom is taking way longer time to establish websocket connections.

Its gets stuck after:

> ready to dec video!  
> ready to dec video!  
> ready to start!  
> ready to start!

Then after around 1min (sometimes even longer) It continues with:

> JsAudioDec.js receive startMedia  
> JsAudioDec.js receive startMedia  
> Open\_Audio\_WebSocket\_Connect  
> Open\_Audio\_WebSocket\_Connect  
> …

Not sure if its something related but I found some websocket requests in network tab originating through Zoom like the ones below:

 ![Screenshot 2022-05-31 at 5.47.24 PM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/f/6/f6986719cbc2041196510ef56431db446c9bae7e.jpeg)

**Which Web Video SDK version?**  
1.2.7

Can you let us know what could be the reason for such long delays in webscoket connections?

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [May 31, 2022, 4:24pm UTC](https://devforum.zoom.us/t/delay-in-websocket-connection/69756/2 "2022-05-31T16:24:49Z")

</div>

Hey @shoaib ,

> [@shoaib](#):
>
> Then after around 1min (sometimes even longer) It continues with:
> 
> > JsAudioDec.js receive startMedia  
> > JsAudioDec.js receive startMedia  
> > Open\_Audio\_WebSocket\_Connect  
> > Open\_Audio\_WebSocket\_Connect  
> > …

Are you in debug mode? Are there issues with the SDK before those logs are printed?

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![shoaib](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shoaib/32/28580_2.png) [@shoaib](https://devforum.zoom.us/u/shoaib)\
**Post date:** [May 31, 2022, 5:00pm UTC](https://devforum.zoom.us/t/delay-in-websocket-connection/69756/3 "2022-05-31T17:00:31Z")

</div>

Hey @tommy ,

> [@tommy](#):
>
> Are you in debug mode?

You mean browser debug mode? No.

> [@tommy](#):
>
> Are there issues with the SDK before those logs are printed?

No. No error or warning gets printed.

**Additional Context:**

- Also, as I mentioned earlier its happening sometimes only.
- Currently, we are testing it in our private environments.
- Its looks like request gets stalled:  
 ![Screenshot 2022-05-31 at 5.52.46 PM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/9/9/99ae44aa1a57838880f6e2e93b06573bea0eca99.png)

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [May 31, 2022, 6:12pm UTC](https://devforum.zoom.us/t/delay-in-websocket-connection/69756/4 "2022-05-31T18:12:04Z")

</div>

Hey @shoaib ,

Interesting. Are there any issues with the Video SDK though? Does the video or audio not work?

I wonder if you are blocking some IPs that we use for the websockets: [https://support.zoom.us/hc/en-us/articles/201362683-Zoom-network-firewall-or-proxy-server-settings](https://support.zoom.us/hc/en-us/articles/201362683-Zoom-network-firewall-or-proxy-server-settings)

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![shoaib](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shoaib/32/28580_2.png) [@shoaib](https://devforum.zoom.us/u/shoaib)\
**Post date:** [May 31, 2022, 6:24pm UTC](https://devforum.zoom.us/t/delay-in-websocket-connection/69756/5 "2022-05-31T18:24:05Z")

</div>

Hey @tommy ,

> [@tommy](#):
>
> Are there any issues with the Video SDK though? Does the video or audio not work?

Until websocket connection are not established, user can’t start video or audio It keeps saying something like:  
on starting video: `Camera is loading, Please wait`.  
on starting audio: `Computer audio is loading, Please wait`.

Once websocket connection are established, video and audio starts working.

> [@tommy](#):
>
> I wonder if you are blocking some IPs that we use for the websockets: [Zoom network firewall or proxy server settings](https://support.zoom.us/hc/en-us/articles/201362683-Zoom-network-firewall-or-proxy-server-settings)

Okay, will check once, But then It should get blocked every time right?

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [June 1, 2022, 7:07pm UTC](https://devforum.zoom.us/t/delay-in-websocket-connection/69756/6 "2022-06-01T19:07:47Z")

</div>

Hey @shoaib ,

After speaking to @vic.yang , we want to suggest upgrading to Video SDK 1.3.0 which includes an improvement around the data center selection logic. Helps reduce latency and improve in-meeting / session performance. Improvements include geo-fencing and greater prioritization of geographically-close servers.

> **[web – Zoom Developer Support](https://devsupport.zoom.us/hc/en-us/sections/9481948737421-web)**

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![shoaib](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shoaib/32/28580_2.png) [@shoaib](https://devforum.zoom.us/u/shoaib)\
**Post date:** [June 1, 2022, 7:43pm UTC](https://devforum.zoom.us/t/delay-in-websocket-connection/69756/7 "2022-06-01T19:43:33Z")

</div>

Okay, Thanks @tommy ,  
Will test in the updated version.

---

<div class="post-metadata">

**Author:** ![shoaib](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shoaib/32/28580_2.png) [@shoaib](https://devforum.zoom.us/u/shoaib)\
**Post date:** [June 20, 2022, 3:22pm UTC](https://devforum.zoom.us/t/delay-in-websocket-connection/69756/8 "2022-06-20T15:22:09Z")

</div>

hey @tommy ,  
We still observed this issue in the latest version as well (`1.3.0`).

Some Additional context:

- Whenever this issue occurred it was observed that the user was joining the call for the first time.
- After `client.join()`API is resolved we ask for audio video permission from user using:  
`navigator.mediaDevices.getUserMedia({ audio: true, video: true })`

---

<div class="post-metadata">

**Author:** ![shoaib](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shoaib/32/28580_2.png) [@shoaib](https://devforum.zoom.us/u/shoaib)\
**Post date:** [June 21, 2022, 7:18am UTC](https://devforum.zoom.us/t/delay-in-websocket-connection/69756/9 "2022-06-21T07:18:54Z")

</div>

In below screenshot, you can see the time these `xhr` requests takes sometimes for some reason.

 ![Screenshot 2022-06-21 at 11.37.15 AM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/1/9/1957df4bb9ff86c7b41be9905375bc17e0d5e70d.png)

---

<div class="post-metadata">

**Author:** ![vic.yang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vic.yang/32/24656_2.png) [@vic.yang](https://devforum.zoom.us/u/vic.yang)\
**Post date:** [June 21, 2022, 7:53am UTC](https://devforum.zoom.us/t/delay-in-websocket-connection/69756/10 "2022-06-21T07:53:24Z")

</div>

Hey @shoaib

Do these assets deployed on your private server or using Zoom-served CDN?

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![shoaib](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shoaib/32/28580_2.png) [@shoaib](https://devforum.zoom.us/u/shoaib)\
**Post date:** [June 21, 2022, 7:57am UTC](https://devforum.zoom.us/t/delay-in-websocket-connection/69756/11 "2022-06-21T07:57:46Z")

</div>

hey @vic.yang , Currently, we are using Zoom-served CDN.

---

<div class="post-metadata">

**Author:** ![vic.yang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vic.yang/32/24656_2.png) [@vic.yang](https://devforum.zoom.us/u/vic.yang)\
**Post date:** [June 21, 2022, 8:39am UTC](https://devforum.zoom.us/t/delay-in-websocket-connection/69756/12 "2022-06-21T08:39:41Z")

</div>

Hey @shoaib

Could you open an individual tab to load the `wasm` file? We want to determine if this is an issue with our CDN network. Or a temporary workaround, serve these dependent assets on your own servers and specify the asset in the `init` method.

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![shoaib](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shoaib/32/28580_2.png) [@shoaib](https://devforum.zoom.us/u/shoaib)\
**Post date:** [June 21, 2022, 9:55am UTC](https://devforum.zoom.us/t/delay-in-websocket-connection/69756/13 "2022-06-21T09:55:30Z")

</div>

hey @vic.yang ,  
So, do you think serving these dependent assets from own servers will be faster than Zoom-served CDN?

Also just one more thing I forgot to mention that we are currently testing in our private environments with VPN turned on, not sure If this has something to do with it.

---

<div class="post-metadata">

**Author:** ![vic.yang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vic.yang/32/24656_2.png) [@vic.yang](https://devforum.zoom.us/u/vic.yang)\
**Post date:** [June 21, 2022, 10:11am UTC](https://devforum.zoom.us/t/delay-in-websocket-connection/69756/14 "2022-06-21T10:11:03Z")

</div>

Hey @shoaib

We tested our CDN service, and it’s fine. Maybe this issue is related to your VPN network.

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![shoaib](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shoaib/32/28580_2.png) [@shoaib](https://devforum.zoom.us/u/shoaib)\
**Post date:** [June 21, 2022, 10:16am UTC](https://devforum.zoom.us/t/delay-in-websocket-connection/69756/15 "2022-06-21T10:16:58Z")

</div>

hey @vic.yang ,  
Okay, will test it without VPN as well.

But apart from this In general what do you recommend (or faster) to use for `init` method: Zoom-served CDN or serving from our own servers?

---

<div class="post-metadata">

**Author:** ![vic.yang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vic.yang/32/24656_2.png) [@vic.yang](https://devforum.zoom.us/u/vic.yang)\
**Post date:** [June 22, 2022, 12:57am UTC](https://devforum.zoom.us/t/delay-in-websocket-connection/69756/16 "2022-06-22T00:57:56Z")

</div>

Hey @shoaib

It depends on you. Our default setting is using the Zoom-served CDN.

For the sake of some companies having their own assets access policies that prevent the use of external resources, we provide the option to use the privately served assets.

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![JackYang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jackyang/32/1135_2.png) [@JackYang](https://devforum.zoom.us/u/JackYang)\
**Post date:** [June 22, 2022, 5:35am UTC](https://devforum.zoom.us/t/delay-in-websocket-connection/69756/17 "2022-06-22T05:35:32Z")

</div>

Could you use [https://www.speedtest.net/](https://www.speedtest.net/) test your speed? we want know your country. you can mask you ip hidden in the test result screenshot.  
we test the [source.zoom.us](http://source.zoom.us) cdn latency can find the issue.  
Thanks  
Jack

---

<div class="post-metadata">

**Author:** ![shoaib](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shoaib/32/28580_2.png) [@shoaib](https://devforum.zoom.us/u/shoaib)\
**Post date:** [June 22, 2022, 6:17am UTC](https://devforum.zoom.us/t/delay-in-websocket-connection/69756/18 "2022-06-22T06:17:24Z")

</div>

hey @JackYang ,  
Below are the speedtest results:

 ![Screenshot 2022-06-22 at 11.41.23 AM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/4/64d9c2a9105f5c92e57736c53fb80fba87331f1b.png)

**Country: India**

Also, this speedtest was ran with VPN turned on.

---

<div class="post-metadata">

**Author:** ![shoaib](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shoaib/32/28580_2.png) [@shoaib](https://devforum.zoom.us/u/shoaib)\
**Post date:** [June 28, 2022, 1:41pm UTC](https://devforum.zoom.us/t/delay-in-websocket-connection/69756/19 "2022-06-28T13:41:15Z")

</div>

hey @vic.yang and @JackYang ,

This I noticed while I was testing on Windows System (this happened only the first time I tried to join call):

 ![zoom(1)](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/8/8/8822fee6dfc2b014b640d3ec551743222b659a37.png)

Look at the time it took to download those files, and I was using the same internet as shown in the [screenshot](https://devforum.zoom.us/t/delay-in-websocket-connection/69756/18).

OS: Windows 10  
Browser: Chrome (Version 103.0.5060.66 (Official Build) (64-bit))

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [July 28, 2022, 11:41pm UTC](https://devforum.zoom.us/t/delay-in-websocket-connection/69756/20 "2022-07-28T23:41:26Z")

</div>

Closed on July 28, 2022, 11:41pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
