Skip to content

[1] Multistream Toggle - Add runtime target functions and error handling. - #6051

Open
michelinewu wants to merge 2 commits into
masterfrom
mw_multistream_toggle_1
Open

[1] Multistream Toggle - Add runtime target functions and error handling.#6051
michelinewu wants to merge 2 commits into
masterfrom
mw_multistream_toggle_1

Conversation

@michelinewu

@michelinewu michelinewu commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Add Runtime Target Management for Mid-Stream Multistream Toggle

Stack: master1 ← 2 ← 3 ← 4 ← 5

Summary

Adds runtime target add/remove/update functionality to the Restream service, enabling mid-stream platform toggling.

Restream Service (app/services/restream.ts)

New interfaces:

  • IRestreamTargetData — payload shape for creating runtime targets (server URL, stream key, platform, label, mode)
  • IRestreamRuntimeTarget — response shape from the runtime API (adds id, state, timestamps)
  • TRestreamTarget — union of IRestreamTarget | IRestreamRuntimeTarget
  • IRestreamResponse — generic API response wrapper with success and message

New methods:

  • addRuntimeTargets(targets) / removeRuntimeTargets(targetIds) — low-level POST/DELETE to /api/v1/rst/targets/runtime
  • addTargets(platforms, destinations, mode) — high-level orchestrator that formats platform and custom destination data into runtime target payloads and calls addRuntimeTargets
  • removeTargets(platforms, destinations, mode) — finds matching existing targets and calls removeRuntimeTargets with their IDs
  • updateTargets(platforms, destinations, mode) — diff-based update: removes targets no longer needed, adds new ones
  • updateTargetsAndValidate(platforms, destinations, mode) — wraps updateTargets with error handling and target state validation
  • filterTargetsByMode(targets, mode) — filters targets by display orientation (horizontal/vertical)
  • isPlatformTarget(target) — type guard distinguishing platform targets from custom destinations
  • formatRuntimePlatformData(platform, mode) — builds IRestreamTargetData from platform settings (supports Twitch, YouTube, Facebook, TikTok, Trovo, X, Kick, Instagram, Patreon)
  • formatRuntimeCustomDestinationData(destination, mode) — builds IRestreamTargetData from custom destination settings

Updated existing methods:

  • createTargets — now accepts optional label field on targets
  • IRestreamTarget.platform — type widened from TPlatform to TPlatform | 'relay', added optional label

Stream Error (app/services/streaming/stream-error.ts)

  • Added RESTREAM_UPDATE_FAILED error type for failures during mid-stream target updates

Files changed:

  • app/services/restream.ts
  • app/services/streaming/stream-error.ts

Performance Implications

None. New methods added but none of them are currently called in the application.

@bundlemon

bundlemon Bot commented Jul 24, 2026

Copy link
Copy Markdown

BundleMon

Files updated (1)
Status Path Size Limits
renderer.(hash).js
10.36MB (+5.58KB +0.05%) -
Unchanged files (3)
Status Path Size Limits
vendors~renderer.(hash).js
4.67MB -
updater.js
115.29KB -
guest-api.js
40.23KB -

Total files change +5.58KB +0.04%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@michelinewu michelinewu added enhancement P0 highest priority to merge from Asana labels Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement P0 highest priority to merge from Asana

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants