Skip to content

Conversation

@cloutiertyler
Copy link
Contributor

Summary

This PR fixes the browser-ts template to use the standard DbConnection pattern instead of a custom Client class.

Changes:

  • Remove the custom Client class that used JSON WebSocket protocol and HTTP for reducer calls
  • Use spacetime generate and the generated DbConnection class with BSATN binary protocol
  • Bundle the TypeScript bindings with vite into an IIFE that exposes DbConnection globally
  • Update index.html to load the bundle and use inline JavaScript

Why this matters:

  • Consistency with the rest of the TypeScript SDK
  • Uses the standard BSATN binary protocol (more efficient than JSON)
  • Uses WebSocket for reducer calls (not HTTP)
  • Follows the established code generation pattern

Test plan

  • Run spacetime dev --template browser-ts test-app
  • Run npm install && npm run build in the created project
  • Open index.html in a browser and verify connection works
  • Add a person and verify real-time updates work

clockwork-tien and others added 2 commits January 29, 2026 17:51
Remove the custom Client class that used JSON protocol and HTTP for
reducer calls. Instead, use the standard DbConnection with code
generation, which uses BSATN binary protocol over WebSocket.

The browser-ts template now:
- Uses spacetime generate for TypeScript bindings
- Bundles bindings with vite into an IIFE
- Loads the bundle in index.html with inline JavaScript
@cloutiertyler
Copy link
Contributor Author

Closing in favor of #4161

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