# Joining meeting timeout issue happening randomly

**URL:** <https://devforum.zoom.us/t/joining-meeting-timeout-issue-happening-randomly/22659>\
**Category:** Web\
**Created:** [June 29, 2020, 2:30pm UTC](https://devforum.zoom.us/t/joining-meeting-timeout-issue-happening-randomly/22659 "2020-06-29T14:30:27Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![edmodev](https://avatars.discourse-cdn.com/v4/letter/e/c4cdca/32.png) [@edmodev](https://devforum.zoom.us/u/edmodev)\
**Post date:** [June 29, 2020, 2:30pm UTC](https://devforum.zoom.us/t/joining-meeting-timeout-issue-happening-randomly/22659/1 "2020-06-29T14:30:27Z")

</div>

**Description**  
I’m working on integrating Zoom meetings into the website I work at using a rails BE and React FE. Init works consistently, but join fails quite often, roughly 1 out of every 3 times it throws the error “Joining meeting timeout”.

**Error**  
Joining meeting timeout  
Your connection has timed out and you cannot join the meeting. Verify your network connectivity and try again.  
{method: “join”, status: false, result: null, errorMessage: undefined, errorCode: 1}

**Which version?**  
1.7.9

**Code snippets**

This is the code I’m using to call the API and create the meeting in the BE (I’ve had no issues there):

```auto
def create_meeting(creator_id, topic)
  params = {
    topic: topic
  }

  response = RestClient.post(
    "#{ZOOM_API_URL}/users/#{creator_id}/meetings",
    params.to_json,
    content_type: :json,
    accept: :json,
    Authorization: 'Bearer ' + jwt_token,
    timeout: 100
  )
  return JSON.parse(response)
end

def jwt_token
  payload = {
    exp: Time.now.to_i + 100,
    iss: OneEye::ZOOM_API_KEY
  }
  JWT.encode payload, ZOOM_API_SECRET, 'HS256', { typ: 'JWT' }
end

```

This is the code used to generate the signature:

```auto
def set_signature(user)
  role = user.id == self.creator_id ? '1' : '0'
  time = (Time.now.to_i * 1000 - 30000).to_s
  data = Base64.urlsafe_encode64(OneEye::ZOOM_API_KEY + self.zoom_id.to_s + time + role)
  hash = Base64.urlsafe_encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), OneEye::ZOOM_API_SECRET, data))
  tempStr = OneEye::ZOOM_API_KEY + '.' + self.zoom_id.to_s + '.' + time + '.' + role + '.' + hash
  self.signature = Base64.urlsafe_encode64(tempStr).gsub('+', '-').gsub('/', '_').gsub(/#{Regexp.escape('=')}+$/, '')
end

```

And this is the Javascript code I’m using to init/join the meeting:

```javascript
import { ZoomMtg } from '@zoomus/websdk';
ZoomMtg.setZoomJSLib('https://source.zoom.us/1.7.8/lib', '/av'); // <= tried 1.7.9 but it results in a JS error
ZoomMtg.preLoadWasm();
ZoomMtg.prepareJssdk();

// In the callback func after the server returns the signature/meetingNumber
const { signature, zoom_id } = response.data; // <= this comes from the BE
ZoomMtg.init({
  leaveUrl: url,
  success: function() {
    ZoomMtg.join({
      signature: signature,
      apiKey: ZOOM_API_KEY,
      meetingNumber: zoom_id,
      userName: UserHelper.formatName(currentUser),
      passWord: '',
      error: function(res){console.log(res)},
      success: function(res){console.log(res)},
    });
  }
});

```

A few things I’ve tried:

- Tested with several different versions of the SDK, starting at 1.7.4; got the same results.
- Added delays to the success functions in case the issue was caused by a race condition, but I got the same results.
- Tried different values for the time param when generating the signature; it didn’t make a difference.

Thanks!

---

<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 30, 2020, 6:42pm UTC](https://devforum.zoom.us/t/joining-meeting-timeout-issue-happening-randomly/22659/2 "2020-06-30T18:42:44Z")

</div>

Hey @edmodev,

Can you make sure that the `ZoomMtg.preLoadWasm();` and `ZoomMtg.prepareJssdk();` functions are completing before joining the meeting? Try giving it a buffer of a few seconds and let me know if that works.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![edmodev](https://avatars.discourse-cdn.com/v4/letter/e/c4cdca/32.png) [@edmodev](https://devforum.zoom.us/u/edmodev)\
**Post date:** [June 30, 2020, 6:49pm UTC](https://devforum.zoom.us/t/joining-meeting-timeout-issue-happening-randomly/22659/3 "2020-06-30T18:49:06Z")

</div>

Unfortunately I actually tried that already, I added as much as 20 sec delay before running init/join, but it didn’t affect the results, it still failed/worked at around the same rate.

Thanks

---

<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:** [July 1, 2020, 8:16pm UTC](https://devforum.zoom.us/t/joining-meeting-timeout-issue-happening-randomly/22659/4 "2020-07-01T20:16:43Z")

</div>

Hey @edmodev,

I think the issue is you are importing the Web SDK locally, and also using the CDN reference.

Can you try removing this line `ZoomMtg.setZoomJSLib('https://source.zoom.us/1.7.8/lib', '/av');`

And make sure your path to the Local Web SDK in node modules is correct:

> **[@zoomus/websdk](https://www.npmjs.com/package/@zoomus/websdk)**
>
> Zoom Web SDK

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![edmodev](https://avatars.discourse-cdn.com/v4/letter/e/c4cdca/32.png) [@edmodev](https://devforum.zoom.us/u/edmodev)\
**Post date:** [July 2, 2020, 1:30pm UTC](https://devforum.zoom.us/t/joining-meeting-timeout-issue-happening-randomly/22659/5 "2020-07-02T13:30:30Z")

</div>

I copied the lib from node\_modules to an accessible location, changed the line into this:

```auto
ZoomMtg.setZoomJSLib('http://localhost:3001/zoom_lib', '/av');

```

And loaded the additional files that are needed:

```auto
<script type="text/javascript" src="http://localhost:3001/zoom_lib/webim.min.js"></script>
<script type="text/javascript" src="http://localhost:3001/zoom_lib/av/js_media.min.js"></script>

```

Retried setting timeouts before both init and join in case there was a race condition while loading those files, but I’m still seeing random failures. Here’s a gif of what I’m experiencing:

 ![zoom](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/2X/0/0f8c1051ac0ebe846c2d14350584a2531fee0a0b.gif)

---

<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:** [July 6, 2020, 9:50pm UTC](https://devforum.zoom.us/t/joining-meeting-timeout-issue-happening-randomly/22659/6 "2020-07-06T21:50:59Z")

</div>

Hey @edmodev,

Are there any errors in the browser console?

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![edmodev](https://avatars.discourse-cdn.com/v4/letter/e/c4cdca/32.png) [@edmodev](https://devforum.zoom.us/u/edmodev)\
**Post date:** [July 9, 2020, 1:24am UTC](https://devforum.zoom.us/t/joining-meeting-timeout-issue-happening-randomly/22659/7 "2020-07-09T01:24:15Z")

</div>

There’s a couple of unrelated errors that I always see when running the code for the website I work at locally:

 ![Screen Shot 2020-07-08 at 7.21.38 PM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/2X/b/b51f3fce2349e4b056b925640d501feaa2a36d97.png)

But the same exact errors are also there when it does work:

 ![Screen Shot 2020-07-08 at 7.21.09 PM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/2X/6/65c002c74d06ea510a793d1f0de3bf0f3894e170.png)

---

<div class="post-metadata">

**Author:** ![edmodev](https://avatars.discourse-cdn.com/v4/letter/e/c4cdca/32.png) [@edmodev](https://devforum.zoom.us/u/edmodev)\
**Post date:** [July 9, 2020, 6:11am UTC](https://devforum.zoom.us/t/joining-meeting-timeout-issue-happening-randomly/22659/8 "2020-07-09T06:11:29Z")

</div>

Just fixed the issue.

Looked for examples of signature generation using ruby and in the one I could find where the user was able to get it to work I noticed that strict\_encode64 was used instead of urlsafe\_encode64, so I tried that. Ever since I made that change, join has been working consistently. The final ruby code looks like this:

```auto
def set_signature(user)
  role = user.id == self.creator_id ? '1' : '0'
  time = (Time.now.to_i * 1000 - 30000).to_s
  data = Base64.strict_encode64(ZOOM_API_KEY + self.zoom_id.to_s + time + role)
  hash = Base64.strict_encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), ZOOM_API_SECRET, data))
  tempStr = ZOOM_API_KEY + '.' + self.zoom_id.to_s + '.' + time + '.' + role + '.' + hash
  self.signature = Base64.strict_encode64(tempStr).gsub('+', '-').gsub('/', '_').gsub(/#{Regexp.escape('=')}+$/, '')
end

```

Thanks for the help!

---

<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:** [July 13, 2020, 10:06pm UTC](https://devforum.zoom.us/t/joining-meeting-timeout-issue-happening-randomly/22659/9 "2020-07-13T22:06:53Z")

</div>

Hey @edmodev,

Happy to hear you got it working! Thanks for sharing the ruby code solution! 🙂

-Tommy

---

<div class="post-metadata">

**Author:** ![DeveloperBot](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/developerbot/32/12632_2.png) [@DeveloperBot](https://devforum.zoom.us/u/DeveloperBot)\
**Post date:** [August 21, 2020, 10:40pm UTC](https://devforum.zoom.us/t/joining-meeting-timeout-issue-happening-randomly/22659/10 "2020-08-21T22:40:45Z")

</div>


