Skip to content

Commit

Permalink
VIDEO-10700-Fix Reconnection Network Test (#1963)
Browse files Browse the repository at this point in the history
* VIDEO-10700 - Fix Unstable Network Test JSDK-2815
  • Loading branch information
PikaJoyce committed Jan 19, 2023
1 parent 1eede4f commit d7cf39d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions lib/twilioconnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ const WS_CLOSE_BUSY_WAIT = 3005;
const WS_CLOSE_SERVER_BUSY = 3006;
const WS_CLOSE_OPEN_TIMEOUT = 3007;

// NOTE(joma): If you want to use close code 3008, please increment
// the close code in test/integration/spec/docker/reconnection.js
// line number 492.

const toplevel = globalThis;
const WebSocket = toplevel.WebSocket ? toplevel.WebSocket : require('ws');

Expand Down
4 changes: 2 additions & 2 deletions test/integration/spec/docker/reconnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ describe('network:', function() {
// eslint-disable-next-line no-warning-comments
// TODO (mmalavalli): Remove environment check once RemoteParticipant "reconnecting"
// state is available in prod version of Room Service.
(identities.length > 1 ? describe : describe.skip)('RemoteParticipant reconnection events (@unstable: JSDK-2815)', () => {
(identities.length > 1 ? describe : describe.skip)('RemoteParticipant reconnection events', () => {
it('should emit "reconnecting" and "reconnected" events on the RemoteParticipant which recovers from signaling connection disruption', async () => {
const [aliceRoom, bobRoom] = rooms;
const aliceRemote = bobRoom.participants.get(aliceRoom.localParticipant.sid);
Expand Down Expand Up @@ -488,7 +488,7 @@ describe('network:', function() {
// closing Alice's WebSocket transport. Then, wait until all the expected
// events are fired. NOTE: this does not work if connected quickly. Also this test is
// should not be in network tests.
aliceRoom._signaling._transport._twilioConnection._close({ code: 3005, reason: 'foo' });
aliceRoom._signaling._transport._twilioConnection._close({ code: 3008, reason: 'foo' });
try {
await waitFor(eventPromises, 'waiting for event promises', 2 * ONE_MINUTE);

Expand Down

0 comments on commit d7cf39d

Please sign in to comment.