Module MountainWebviewPostMessageFromGuest

Module MountainWebviewPostMessageFromGuest 

Source
Expand description

§MountainWebviewPostMessageFromGuest (Track)

§RESPONSIBILITIES

This module provides a Tauri command handler for a Webview guest to post a message back to the extension host.

§Core Functions:

  • Get IPC provider from runtime
  • Forward message to main Cocoon sidecar
  • Handle IPC errors gracefully

§ARCHITECTURAL ROLE

MountainWebviewPostMessageFromGuest acts as the webview message forwarder in Track’s dispatch layer:

Webview (Guest) ──► MountainWebviewPostMessageFromGuest ──► IPC Provider ──► Cocoon (Sidecar)

§KEY COMPONENTS

  • Fn: Main webview message forwarding function (public async fn Fn)

§ERROR HANDLING

  • IPC communication errors are logged and propagated to caller
  • Provider requirement failures are propagated

§LOGGING

  • Message forwarding failures are logged at error level
  • Log format: “[Track/Webview] Forwarding webview message to Cocoon”

§PERFORMANCE CONSIDERATIONS

  • Direct IPC provider access without intermediate overhead
  • Async IPC operations to avoid blocking

§TODO

  • Add message validation before forwarding
  • Implement message rate limiting
  • Add message metrics and telemetry

Functions§

MountainWebviewPostMessageFromGuest
A specific Tauri command handler for a Webview guest to post a message back to the extension host.