-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/add websocket events callback #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Add createRealTimeSubscribeClient for read-only subscription to existing sessions - Move SessionInfo type to types.ts for better organization - Support receive-only WebRTC mode in webrtc-connection.ts - Fix any type in webrtc-manager.ts getSessionInfo()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds WebSocket message event observability and subscribe-only client functionality to the realtime SDK, enabling monitoring of existing sessions and better visibility into session state.
- Exposes WebSocket events (
promptAck,imageSet,generationStarted) and session information through the public API - Adds read-only subscription client for spectating/monitoring existing realtime sessions
- Supports receive-only WebRTC mode by allowing null local streams
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/sdk/src/realtime/webrtc-manager.ts | Adds getSessionInfo() method to expose session connection details |
| packages/sdk/src/realtime/webrtc-connection.ts | Implements session info tracking, generation started events, and receive-only WebRTC mode |
| packages/sdk/src/realtime/types.ts | Defines new message types for generation started and session info |
| packages/sdk/src/realtime/subscribe-client.ts | New subscribe-only client for read-only access to existing sessions |
| packages/sdk/src/realtime/client.ts | Forwards WebSocket events to main emitter and adds getSessionInfo() to client API |
| packages/sdk/src/index.ts | Exports subscribe client and related types |
| examples/sdk-core/README.md | Documents usage of the new subscribe client feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
packages/sdk/src/index.ts:1
- The example doesn't show error handling for when
getSessionInfo()returnsnull(e.g., if called before the session_id message is received). Add a null check in the example to demonstrate proper usage.
import { z } from "zod";
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This PR adds two features to the sdk:
Exposes WebSocket message events and session information through the public API, enabling better observability and control over realtime sessions.
Changes:
Adds a new createRealTimeSubscribeClient that allows read-only subscription to existing realtime sessions, enabling use cases like spectating or monitoring.
Changes:
Adds WebRTC connection diagnostics to the RealTimeClient:
Note
Enables spectating/monitoring of existing realtime sessions and improves observability of active sessions.
realtimeSubscribeviacreateRealTimeSubscribeClientwith receive‑only WebRTC support (nulllocalStream) andSubscribeEventspromptAck,imageSet,generationStarted) throughRealTimeClientby forwarding fromWebRTCConnectionSessionIdMessage, stored asSessionInfo, andgetSessionInfo()onRealTimeClientWebRTCConnectionto handlegeneration_started,session_id, recvonly transceivers, and exportsSessionInfoindex.tsand documents usage with a concise example inexamples/sdk-core/README.mdWritten by Cursor Bugbot for commit 7d4e72f. This will update automatically on new commits. Configure here.