Skip to main content

phase_workers_ws_open_key

Function phase_workers_ws_open_key 

Source
pub fn phase_workers_ws_open_key(
    target: BuildTarget,
    parsed: &[ParsedFile],
    groups: &BTreeMap<String, Vec<usize>>,
    kinds: &BTreeMap<String, UnitKind>,
    unit_tables: &HashMap<String, UnitTable>,
    unit_uses: &HashMap<String, Vec<String>>,
    errors: &mut ErrorSink,
)
Expand description

#2959: on the Workers target, the edge (compose.ts) addresses the Durable Object hosting a WebSocket connection before the on open body runs, so the key of the body’s connection transfer must be something it can evaluate on its own: a route parameter, a constant of the context (its own, or a public one of a commons it uses, #2967) or a literal (crate::websocket::classify_open_key). Any other key — a let-bound local, a field access, a call — used to be emitted as a name compose.ts does not bind (a tsc failure) or replaced by the first route parameter (the upgrade silently reached a different instance than the one the body addressed). On the bundle target the open is an ordinary surface method that evaluates any key, so the check is Workers-only, like phase_workers_ws_open_split.