Skip to content

Conversation

@stukennedy
Copy link

@stukennedy stukennedy commented Sep 14, 2025

This allows a user to choose to use a proxy of the Websocket client
e.g. with https://github.com/stukennedy/anam-ws-proxy

Use-case for this is a man-in-the-middle approach, where a 3rd-party server handles their own orchestration layer -> LLM inference and then stream talks directly in the Anam Websocket, cutting out the need to send responses back to the client and for the client to send the talk stream to Anam.
The client also doesn't need to negotiate the session at all, just gets a signalling websocket from the server which negotiates the WebRTC session.


Summary by cubic

Add proxy transport mode to the JS SDK, enabling server-side session negotiation and custom signaling over a proxied WebSocket. This lets a backend orchestrate inference and stream directly to Anam while the client only connects to your proxy.

  • New Features
    • Proxy transport: transport.mode='proxy' with baseUrl, optional startSessionPath and agentWsPathTemplate, getUserId, and headers in AnamPublicClientOptions.
    • ExternalSessionClient: starts sessions via your server and returns engine/signaling details.
    • AnamClient: uses ExternalSessionClient in proxy mode and passes an absolute WebSocket URL to SignallingClient.
    • SignallingClient: supports absoluteWsUrl; adds sendCustom(actionType, payload) and sendBinary(...).
    • SignalMessage: actionType widened to string for custom actions.
    • Types/TS: baseUrl now optional in SignallingURLOptions; DOM lib and skipLibCheck enabled; minimal buffer shim for browser builds. Direct mode remains the default.

Written for commit c439054. Summary will update on new commits.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 8 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="src/types/signalling/SignallingClientOptions.ts">

<violation number="1" location="src/types/signalling/SignallingClientOptions.ts:2">
Making baseUrl optional removes compile-time enforcement; invalid configs are now caught only at runtime. Consider a discriminated union where either absoluteWsUrl is provided or baseUrl is required.</violation>
</file>


Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Ask questions if you need clarification on any suggestion

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

refactor: enhance SignallingClientOptions with structured URL options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants