Course lesson 44 · Advanced Durable Objects
Service to Service Bindings
The frontend’s Worker receives a service binding to the data service and becomes the browser’s WebSocket entry point. A small Hono application handles both tRPC routing and the socket proxy, adding an account header before forwarding the request through the binding. Local and deployed checks confirm that one click reaches multiple open dashboard tabs.
Primary source: course video 44 · Supplied English subtitles · 00:10:49.
Understand the idea
- A service binding references another Worker by its configured service name and exposes a fetch interface.
- The browser connects to its own application host; server-side code forwards the request to the data service.
- The future authentication boundary sits before proxying, where trusted account information can be added.
- Hono replaces manual pathname branching as the user application gains additional routes.
- Environment configuration must provide the correct browser base host for local and deployed builds.
What the course does
- Remove the backend’s hardcoded account so it again reads the account header.
- Declare the data-service binding in the user application’s Wrangler configuration and regenerate types.
- Create Hono routes for existing tRPC handling and the new socket endpoint.
- Clone the incoming request with an account header and call the bound service’s fetch handler.
- Point the frontend environment at localhost for the local test, then at the deployed user-application host for deployment.
- Open two dashboard tabs and confirm that a redirect click broadcasts to both.
Watch for
- The proxy still sets account identity manually until the authentication section implements a real session-derived value.
- The lesson uses an experimental remote-development setting; treat that configuration as recording-time tooling.
- The instructor explicitly notes that several dashboard statistics are still dummy values at this point.
Recall before revealing
What changes in the browser when the service binding is introduced?
Reveal the explanation
It targets the user application’s host instead of hardcoding the data service host; the Worker performs the forwarding.
Try it
Describe the request route from a dashboard tab to the account tracker, identifying where authentication will be added.
Check your result
Your route is browser → user-application Worker → bound data service → account Durable Object, with authentication at the user-application Worker.
Practice prompts and answer checks are added teaching material. Answer from memory first, then compare and explain any difference.
Rewatch only what you need
Open this lesson in your original course library and seek to the times below. Videos are not hosted on this site.
- 00:02:02 — Declaring a service binding
- 00:05:03 — Hono socket proxy and account header
- 00:07:05 — Local proxy connection test
- 00:09:38 — Broadcast verification across two tabs
Companion primary documentation: Workers remote procedure calls. For recorded API names, commands, limits, and prices, check the version you use.