Skip to content

Commit

Permalink
fix: query param is appended multiple times (#368)
Browse files Browse the repository at this point in the history
* fix: query param is  appended multiple times

* chore: update node
  • Loading branch information
farhat-ha authored Aug 22, 2024
1 parent 616a2c3 commit 14c2711
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ jobs:
run: |
git config user.name TelnyxIntegrations
git config user.email [email protected]
- name: Use Node.js 16.x
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: "16"
node-version: "18"
cache: "yarn"
registry-url: https://registry.npmjs.org/
- name: Install shared dependencies
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ jobs:
run: |
git config user.name TelnyxIntegrations
git config user.email [email protected]
- name: Use Node.js 16.x
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: "16.x"
node-version: "18.x"
cache: "yarn"
registry-url: https://registry.npmjs.org/
- name: Install shared dependencies
Expand Down Expand Up @@ -106,10 +106,10 @@ jobs:
run: |
git config user.name TelnyxIntegrations
git config user.email [email protected]
- name: Use Node.js 16.x
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: "16.x"
node-version: "18.x"
cache: "yarn"
registry-url: https://registry.npmjs.org/
- name: Install shared dependencies
Expand Down Expand Up @@ -144,10 +144,10 @@ jobs:
run: |
git config user.name TelnyxIntegrations
git config user.email [email protected]
- name: Use Node.js 16.x
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: "16.x"
node-version: "18.x"
cache: "yarn"
registry-url: https://registry.npmjs.org/
- name: Install shared dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/webrtc-cdn-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ jobs:
run: |
git config user.name TelnyxIntegrations
git config user.email [email protected]
- name: Use Node.js 16.x
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: "16.x"
node-version: "18.x"
cache: "yarn"
registry-url: https://registry.npmjs.org/
- name: Install shared dependencies
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/webrtc-test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
ref: ${{ github.ref }}
fetch-depth: 0

- name: Use Node.js 16.x
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: "16.x"
node-version: "18.x"
cache: "yarn"
registry-url: https://registry.npmjs.org/
- name: Install shared dependencies
Expand All @@ -48,10 +48,10 @@ jobs:
ref: "main"
# https://github.com/release-it/release-it/issues/657#issuecomment-647848200
fetch-depth: 0
- name: Use Node.js 16.x
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: "16.x"
node-version: "18.x"
cache: "yarn"
registry-url: https://registry.npmjs.org/
- name: Install shared dependencies
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16
v18
7 changes: 5 additions & 2 deletions packages/js/src/Modules/Verto/services/Connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import { registerOnce, trigger } from './Handler';
import { GatewayStateType } from '../webrtc/constants';
import { getReconnectToken, setReconnectToken } from '../util/reconnect';
import { attachMediaStream } from '../util/webrtc';

let WebSocketClass: any = typeof WebSocket !== 'undefined' ? WebSocket : null;
export const setWebSocket = (websocket: any): void => {
Expand Down Expand Up @@ -71,12 +72,14 @@ export default class Connection {
}

connect() {
const websocketUrl = new URL(this._host);
const reconnectToken = getReconnectToken();

if (reconnectToken) {
this._host += `?voice_sdk_id=${reconnectToken}`;
websocketUrl.searchParams.set('voice_sdk_id', reconnectToken);
}

this._wsClient = new WebSocketClass(this._host);
this._wsClient = new WebSocketClass(websocketUrl.toString());
this._wsClient.onopen = (event): boolean =>
trigger(SwEvent.SocketOpen, event, this.session.uuid);
this._wsClient.onclose = (event): boolean =>
Expand Down

0 comments on commit 14c2711

Please sign in to comment.