@@ -166,37 +166,72 @@ The Worker can fan out transcriptions to a separate Transcription Dispatcher wor
1661662 . Container decodes audio and gets transcriptions from OpenAI
1671673 . Worker intercepts transcriptions and:
168168 - Forwards to media server via WebSocket (low latency path)
169- - Asynchronously dispatches to Dispatcher worker via RPC (doesn't block)
169+ - Asynchronously dispatches to Dispatcher worker (doesn't block)
170+
171+ ** Dispatch Methods (in order of preference):**
172+
173+ 1 . ** Cloudflare Queue** (recommended) - Messages sent to a queue, consumed by Dispatcher
174+ - Doesn't count against the 50 subrequest limit per WebSocket connection
175+ - Better for high-throughput scenarios
176+
177+ 2 . ** Service Binding RPC** (fallback) - Direct RPC call to Dispatcher worker
178+ - Each dispatch counts as a subrequest (50 limit per WebSocket lifetime)
179+ - Use only for low-traffic scenarios
180+
181+ ** Setup with Queue (Recommended):**
182+
183+ 1 . Deploy your Transcription Dispatcher worker with queue consumer configured
184+ 2 . Update ` wrangler.jsonc ` to add a queue producer:
185+ ``` jsonc
186+ " queues" : {
187+ " producers" : [{
188+ " binding" : " TRANSCRIPTION_QUEUE" ,
189+ " queue" : " transcription-dispatch-queue-staging"
190+ }]
191+ }
192+ ```
193+ 3 . Set ` USE_DISPATCHER ` environment variable:
194+ ``` jsonc
195+ " vars" : {
196+ " USE_DISPATCHER" : " true"
197+ }
198+ ```
199+ 4 . Or enable per-connection with query parameter:
200+ ```
201+ wss://your-worker.workers.dev/transcribe?sessionId=test&transcribe=true&sendBack=true&useDispatcher=true
202+ ```
203+
204+ ** Setup with RPC (Fallback):**
170205
171- ** Setup:**
1722061 . Deploy your Transcription Dispatcher worker (must implement the ` dispatch() ` RPC method)
173- 2 . Update ` wrangler-container .jsonc ` to point to your dispatcher :
207+ 2 . Update ` wrangler.jsonc ` to add a service binding :
174208 ``` jsonc
175209 " services" : [{
176210 " binding" : " TRANSCRIPTION_DISPATCHER" ,
177- " service" : " your-dispatcher-worker-name" ,
178- " environment" : " production"
211+ " service" : " transcription-dispatcher"
179212 }]
180213 ```
181- 3 . Connect with ` useDispatcher=true ` :
182- ```
183- wss://your-worker.workers.dev/transcribe?sessionId=test&transcribe=true&sendBack=true&useDispatcher=true
184- ```
214+ 3 . Enable with ` USE_DISPATCHER=true ` or ` useDispatcher=true ` query param
185215
186- ** Dispatcher Interface:**
187- Your dispatcher worker must implement:
188- ``` typescript
189- export interface TranscriptionDispatcher extends WorkerEntrypoint <Env > {
190- dispatch(message : DispatcherTranscriptionMessage ): Promise <RPCResponse >;
191- }
216+ ** Environment Variables:**
217+ - ` USE_DISPATCHER ` - Set to ` "true" ` to enable dispatching by default (can be overridden per-connection via URL param)
192218
219+ ** Message Format:**
220+ ``` typescript
193221interface DispatcherTranscriptionMessage {
194222 sessionId: string ;
195223 endpointId: string ; // participant ID
196224 text: string ; // full transcript text
197225 timestamp: number ;
198226 language? : string ;
199227}
228+ ```
229+
230+ ** Dispatcher Interface (for RPC fallback):**
231+ ``` typescript
232+ export interface TranscriptionDispatcher extends WorkerEntrypoint <Env > {
233+ dispatch(message : DispatcherTranscriptionMessage ): Promise <RPCResponse >;
234+ }
200235
201236interface RPCResponse {
202237 success: boolean ;
@@ -206,7 +241,7 @@ interface RPCResponse {
206241}
207242```
208243
209- See the original dispatcher implementation on the ` main ` branch for a reference implementation.
244+ See the [ transcription- dispatcher] ( https://github.com/jitsi/vo_meetings_cf-transcription-dispatcher ) repository for the dispatcher implementation.
210245
211246### Monitoring
212247
@@ -341,7 +376,7 @@ Media Server (WebSocket)
341376 ↓
342377Cloudflare Worker (intercepts & fans out)
343378 ↓ ↓
344- ↓ (audio) (transcripts via RPC)
379+ ↓ (audio) (transcripts via Queue/ RPC)
345380 ↓ ↓
346381Container Instance Transcription Dispatcher
347382 ↓ (optional, parallel)
@@ -364,7 +399,7 @@ Media Server (receives transcripts)
3643993 . OpenAI returns transcripts → Container → Worker
3654004 . Worker fans out transcripts to:
366401 - Media server (via WebSocket, low latency)
367- - Dispatcher (via Service Binding RPC, async, optional)
402+ - Dispatcher (via Queue or RPC, async, optional)
368403
369404Each container instance:
370405- Runs the full Node.js application
0 commit comments