Skip to content

Samples: Signaling reconnect and refresh/cache turn credentials#465

Merged
sirknightj merged 2 commits intodevelopfrom
master-reconnect-feature
Apr 10, 2025
Merged

Samples: Signaling reconnect and refresh/cache turn credentials#465
sirknightj merged 2 commits intodevelopfrom
master-reconnect-feature

Conversation

@sirknightj
Copy link
Copy Markdown
Contributor

Issue #, if available:

Description of changes:

Background

  • Currently, the sample application only fetches TURN servers when the button is clicked. TURN server credentials (used to initiate a TURN server connection) expire after 5 minutes (300 seconds).
  • Therefore, if you try to re-initiate a connection (e.g. JoinStorageSession again after the 1 hour limit), the connection will fail if TURN is required on the client side.
  • Signaling also has a 10-minute idle timeout. If there is no signaling channel activity for 10 minutes, you get disconnected.

Summary

This PR introduces a more robust mechanism for managing ICE server credentials and optionally supports automatic signaling reconnection in master mode. It also improves logging and enhances maintainability by cleaning up redundant code and clarifying logic flows.

Changes

  • Added logic to cache the ICE servers and refresh them only when needed, specifically upon receiving an SDP offer.
    • Improves scalability by avoiding unnecessary network usage ensuring efficient use of both browser and backend resources.
    • TURN credentials are cached in-memory (for the current run), and they are not written to localStorage or cookies.
  • Added new checkbox (signaling-reconnect) to the UI for enabling signaling reconnection after idle timeout.
    • When enabled (and ingestion mode is not active), the master client will automatically attempt to reopen the signaling channel upon disconnection. (Ideally, we'd use ping frames, but browsers do not have support for it)

Minor Changes

  • Ran linter on the rename-output-file.js
  • Address comment regarding the log line in rename-output-file.js from Migrate the sample page to v3 #426
  • Minor HTML spacing tweak to improve layout under the Advanced settings.

Testing

  • Check JoinStorageSession automatically reconnects with the TURN after 1 hour (and GetIceServerConfig is called again).
  • Confirmed signaling reconnect triggers on idle disconnect when checkbox is enabled.
  • Check master with the signaling reconnect feature can still have viewers joining via TURN more than 5 minutes after the button is pressed.
  • Regression tested existing master/viewer flows across default and advanced settings.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@sirknightj sirknightj added Samples Questions related to Samples 2.4.0 labels Apr 9, 2025
@sirknightj sirknightj merged commit efdec33 into develop Apr 10, 2025
7 checks passed
@sirknightj sirknightj deleted the master-reconnect-feature branch April 10, 2025 22:48
@sirknightj sirknightj mentioned this pull request Apr 14, 2025
sirknightj added a commit that referenced this pull request Apr 15, 2025
* Auto-merge dependabot & retarget to develop (#451)

* Bump eslint from 9.18.0 to 9.24.0 (#450)

Bumps [eslint](https://github.com/eslint/eslint) from 9.18.0 to 9.24.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](eslint/eslint@v9.18.0...v9.24.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-version: 9.24.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @types/node from 22.10.6 to 22.14.0 (#449)

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 22.10.6 to 22.14.0.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump eslint-plugin-prettier from 5.2.1 to 5.2.6 (#448)

Bumps [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) from 5.2.1 to 5.2.6.
- [Release notes](https://github.com/prettier/eslint-plugin-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-plugin-prettier/blob/main/CHANGELOG.md)
- [Commits](prettier/eslint-plugin-prettier@v5.2.1...v5.2.6)

---
updated-dependencies:
- dependency-name: eslint-plugin-prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @typescript-eslint/parser from 8.20.0 to 8.29.0 (#445)

Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 8.20.0 to 8.29.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.29.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @typescript-eslint/eslint-plugin from 8.20.0 to 8.29.0 (#444)

Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 8.20.0 to 8.29.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.29.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump undici from 6.21.0 to 6.21.1 (#401)

Bumps [undici](https://github.com/nodejs/undici) from 6.21.0 to 6.21.1.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](nodejs/undici@v6.21.0...v6.21.1)

---
updated-dependencies:
- dependency-name: undici
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump image-size from 1.2.0 to 1.2.1 (#447)

Bumps [image-size](https://github.com/image-size/image-size) from 1.2.0 to 1.2.1.
- [Release notes](https://github.com/image-size/image-size/releases)
- [Commits](image-size/image-size@v1.2.0...v1.2.1)

---
updated-dependencies:
- dependency-name: image-size
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump eslint-config-prettier from 10.0.1 to 10.1.1 (#452)

Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 10.0.1 to 10.1.1.
- [Release notes](https://github.com/prettier/eslint-config-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md)
- [Commits](prettier/eslint-config-prettier@v10.0.1...v10.1.1)

---
updated-dependencies:
- dependency-name: eslint-config-prettier
  dependency-version: 10.1.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump fork-ts-checker-webpack-plugin from 9.0.2 to 9.1.0 (#453)

Bumps [fork-ts-checker-webpack-plugin](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin) from 9.0.2 to 9.1.0.
- [Release notes](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/releases)
- [Changelog](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/blob/main/CHANGELOG.md)
- [Commits](TypeStrong/fork-ts-checker-webpack-plugin@v9.0.2...v9.1.0)

---
updated-dependencies:
- dependency-name: fork-ts-checker-webpack-plugin
  dependency-version: 9.1.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump webpack from 5.97.1 to 5.99.0 (#454)

Bumps [webpack](https://github.com/webpack/webpack) from 5.97.1 to 5.99.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](webpack/webpack@v5.97.1...v5.99.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-version: 5.99.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump ws from 8.18.0 to 8.18.1 (#455)

Bumps [ws](https://github.com/websockets/ws) from 8.18.0 to 8.18.1.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](websockets/ws@8.18.0...8.18.1)

---
updated-dependencies:
- dependency-name: ws
  dependency-version: 8.18.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump typescript from 5.7.3 to 5.8.3 (#456)

Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.7.3 to 5.8.3.
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release-publish.yml)
- [Commits](https://github.com/microsoft/TypeScript/commits)

---
updated-dependencies:
- dependency-name: typescript
  dependency-version: 5.8.3
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump prettier from 3.4.2 to 3.5.3 (#458)

Bumps [prettier](https://github.com/prettier/prettier) from 3.4.2 to 3.5.3.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](prettier/prettier@3.4.2...3.5.3)

---
updated-dependencies:
- dependency-name: prettier
  dependency-version: 3.5.3
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump webpack-dev-server from 5.2.0 to 5.2.1 (#459)

Bumps [webpack-dev-server](https://github.com/webpack/webpack-dev-server) from 5.2.0 to 5.2.1.
- [Release notes](https://github.com/webpack/webpack-dev-server/releases)
- [Changelog](https://github.com/webpack/webpack-dev-server/blob/master/CHANGELOG.md)
- [Commits](webpack/webpack-dev-server@v5.2.0...v5.2.1)

---
updated-dependencies:
- dependency-name: webpack-dev-server
  dependency-version: 5.2.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump ts-jest from 29.2.5 to 29.3.1 (#460)

Bumps [ts-jest](https://github.com/kulshekhar/ts-jest) from 29.2.5 to 29.3.1.
- [Release notes](https://github.com/kulshekhar/ts-jest/releases)
- [Changelog](https://github.com/kulshekhar/ts-jest/blob/main/CHANGELOG.md)
- [Commits](kulshekhar/ts-jest@v29.2.5...v29.3.1)

---
updated-dependencies:
- dependency-name: ts-jest
  dependency-version: 29.3.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Migrate the sample page to v3 (#426)

* Migrate the test page to v3

* Debug build, use production build on github pages

* Address comments

* Add a link to the aws-sdk-build in the main readme

* Bump webpack from 5.99.0 to 5.99.4 (#464)

Bumps [webpack](https://github.com/webpack/webpack) from 5.99.0 to 5.99.4.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](webpack/webpack@v5.99.0...v5.99.4)

---
updated-dependencies:
- dependency-name: webpack
  dependency-version: 5.99.4
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump webpack from 5.99.4 to 5.99.5 (#466)

Bumps [webpack](https://github.com/webpack/webpack) from 5.99.4 to 5.99.5.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](webpack/webpack@v5.99.4...v5.99.5)

---
updated-dependencies:
- dependency-name: webpack
  dependency-version: 5.99.5
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump eslint-config-prettier from 10.1.1 to 10.1.2 (#467)

Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 10.1.1 to 10.1.2.
- [Release notes](https://github.com/prettier/eslint-config-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md)
- [Commits](prettier/eslint-config-prettier@v10.1.1...v10.1.2)

---
updated-dependencies:
- dependency-name: eslint-config-prettier
  dependency-version: 10.1.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Samples: Signaling reconnect and refresh/cache turn credentials (#465)

* Signaling reconnect and refresh ice server config

* Address comments

* Add the event listener only once (#463)

* Update Master and Viewer Logic for Determining whether to use STUN Server (#434)

* Master - don't add STUN server for sendPrflxCandidates

* Viewer - add STUN only if sendSrflxCandidates is checked

---------

Co-authored-by: sirknightj <jggunawa@amazon.com>

* Bump project version to 2.3.3 (#462)

* Bump version to 2.4.0 (#468)

* Correct comment about file size for optimized build (#470)

* Bump @typescript-eslint/parser from 8.29.1 to 8.30.0 (#472)

Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 8.29.1 to 8.30.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.30.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-version: 8.30.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump ts-jest from 29.3.1 to 29.3.2 (#475)

Bumps [ts-jest](https://github.com/kulshekhar/ts-jest) from 29.3.1 to 29.3.2.
- [Release notes](https://github.com/kulshekhar/ts-jest/releases)
- [Changelog](https://github.com/kulshekhar/ts-jest/blob/main/CHANGELOG.md)
- [Commits](kulshekhar/ts-jest@v29.3.1...v29.3.2)

---
updated-dependencies:
- dependency-name: ts-jest
  dependency-version: 29.3.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @types/node from 22.14.0 to 22.14.1 (#471)

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 22.14.0 to 22.14.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-version: 22.14.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @typescript-eslint/eslint-plugin from 8.29.1 to 8.30.0 (#474)

Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 8.29.1 to 8.30.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.30.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-version: 8.30.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump jsdom from 26.0.0 to 26.1.0 (#473)

Bumps [jsdom](https://github.com/jsdom/jsdom) from 26.0.0 to 26.1.0.
- [Release notes](https://github.com/jsdom/jsdom/releases)
- [Changelog](https://github.com/jsdom/jsdom/blob/main/Changelog.md)
- [Commits](jsdom/jsdom@26.0.0...26.1.0)

---
updated-dependencies:
- dependency-name: jsdom
  dependency-version: 26.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Add the update media storage configuration to v3 (#476)

* Cleanup listeners properly (#477)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Stefan Kieszkowski <85728496+stefankiesz@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.4.0 Samples Questions related to Samples WebRTC Ingestion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants