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):
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:
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:
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!