-
Notifications
You must be signed in to change notification settings - Fork 46
Move .connect to .wsConnect within DO stub #175
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
Conversation
🦋 Changeset detectedLatest commit: 25aac51 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Claude Code ReviewSummary: This PR successfully moves WebSocket connection functionality from a standalone Issues Found1. Dummy implementation throws on RPC call (sandbox.ts:346-349) The wsConnect(request: Request, port: number): Promise<Response> {
throw new Error('wsConnect must be called on the stub returned by getSandbox(), not directly on the DO instance');
}2. Type inconsistency in shared/types.ts The 3. Generated worker-configuration.d.ts files (16,759 lines) Two massive auto-generated type files were committed:
While the .gitignore was updated to allow these, consider whether these should be in version control or generated at build time. They bloat the PR diff significantly. Testing Coverage✅ Excellent test coverage in sandbox.test.ts:
Architecture Alignment✅ The change aligns well with the ergonomic API goal. Using ✅ The Changeset✅ Proper changeset created for patch release. Recommendation: Merge after addressing the error message clarity in issue #1. Issues #2-3 are minor/non-blocking. |
This gets around IDEs not being able to do go-to-definition due to mapped types not being resolved properly. This is less truthful perhaps (hides RPC semantics), but more useful for developers.
commit: |
🐳 Docker Image PublishedFROM cloudflare/sandbox:0.0.0-pr-175-5713c01Version: You can use this Docker image with the preview package from this PR. |
Moves the WebSocket connection functionality from a standalone
connect()function to a.wsConnect()method on the Durable Object stub.Before:
After:
This provides a more ergonomic API by treating WebSocket connections as a first-class method on the sandbox instance, rather than requiring a separate import and function call. The implementation attaches the method in
getSandbox()to avoid RPC serialization issues with WebSocket connections.