Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mercury): add client timestamp #3993

Merged
merged 5 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/@webex/internal-plugin-mercury/src/mercury.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ const Mercury = WebexPlugin.extend({
webSocketUrl.query.multipleConnections = true;
}

webSocketUrl.query.clientTimestamp = Date.now();

return url.format(webSocketUrl);
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ describe('plugin-mercury', () => {
assert.isFalse(mercury.connecting, 'Mercury is not connecting');
assert.calledWith(
Socket.prototype.open,
sinon.match(/ws:\/\/providedurl.com/),
sinon.match(/ws:\/\/providedurl.com.*clientTimestamp[=]\d+/),
sinon.match.any
);
});
Expand Down Expand Up @@ -783,16 +783,16 @@ describe('plugin-mercury', () => {
it('uses provided webSocketUrl', () =>
webex.internal.mercury
._prepareUrl('ws://provided.com')
.then((wsUrl) => assert.match(wsUrl, /provided.com/)));
.then((wsUrl) => assert.match(wsUrl, /.*provided.com.*/)));
it('requests text-mode WebSockets', () =>
webex.internal.mercury
._prepareUrl()
.then((wsUrl) => assert.match(wsUrl, /outboundWireFormat=text/)));
.then((wsUrl) => assert.match(wsUrl, /.*outboundWireFormat=text.*/)));

it('requests the buffer state message', () =>
webex.internal.mercury
._prepareUrl()
.then((wsUrl) => assert.match(wsUrl, /bufferStates=true/)));
.then((wsUrl) => assert.match(wsUrl, /.*bufferStates=true.*/)));

it('does not add conditional properties', () =>
webex.internal.mercury._prepareUrl().then((wsUrl) => {
Expand Down
Loading