fix(load-test): Uses websocket if available and adds room param to the connection url.

This commit is contained in:
damencho 2021-02-09 14:42:06 -06:00 committed by Дамян Минков
parent ef6b641802
commit f4d0ec1bb4
1 changed files with 3 additions and 1 deletions

View File

@ -178,7 +178,7 @@ function onUserLeft(id) {
* That function is called when connection is established successfully * That function is called when connection is established successfully
*/ */
function onConnectionSuccess() { function onConnectionSuccess() {
room = connection.initJitsiConference(roomName, config); room = connection.initJitsiConference(roomName.toLowerCase(), config);
room.on(JitsiMeetJS.events.conference.TRACK_ADDED, onRemoteTrack); room.on(JitsiMeetJS.events.conference.TRACK_ADDED, onRemoteTrack);
room.on(JitsiMeetJS.events.conference.CONFERENCE_JOINED, onConferenceJoined); room.on(JitsiMeetJS.events.conference.CONFERENCE_JOINED, onConferenceJoined);
room.on(JitsiMeetJS.events.conference.USER_JOINED, id => { room.on(JitsiMeetJS.events.conference.USER_JOINED, id => {
@ -232,6 +232,8 @@ JitsiMeetJS.setLogLevel(JitsiMeetJS.logLevels.ERROR);
JitsiMeetJS.init(config); JitsiMeetJS.init(config);
config.serviceUrl = config.bosh = `${config.websocket || config.bosh}?room=${roomName.toLowerCase()}`;
connection = new JitsiMeetJS.JitsiConnection(null, null, config); connection = new JitsiMeetJS.JitsiConnection(null, null, config);
connection.addEventListener(JitsiMeetJS.events.connection.CONNECTION_ESTABLISHED, onConnectionSuccess); connection.addEventListener(JitsiMeetJS.events.connection.CONNECTION_ESTABLISHED, onConnectionSuccess);
connection.addEventListener(JitsiMeetJS.events.connection.CONNECTION_FAILED, onConnectionFailed); connection.addEventListener(JitsiMeetJS.events.connection.CONNECTION_FAILED, onConnectionFailed);