Summary
AddWebBrokerApiBinding in event-gateway/gateway-runtime/internal/runtime/runtime.go
registers receivers on r.wsMux but never records the route path in bindingPaths.
As a result, RemoveWebBrokerApiBinding cannot remove the handler from the mux and
leaves stale WebSocket routes active after the binding is removed via xDS.
Steps to reproduce
- Start the event gateway in xDS (control plane) mode.
- Add a
WebBrokerApi binding via xDS — a handler is registered on r.wsMux.
- Delete or update the binding via xDS —
RemoveWebBrokerApiBinding is called.
- The route remains active on
r.wsMux because the path was never stored in
bindingPaths and r.websubMux.Remove is called instead of a removal on r.wsMux.
Required changes
- Record each registered WebBrokerApi path in
bindingPaths[wbb.Name] inside
AddWebBrokerApiBinding.
- Switch
r.wsMux from *http.ServeMux to a removable mux implementation
(e.g., the existing DynamicMux type, same as r.websubMux) so routes can be
deregistered.
- Update
RemoveWebBrokerApiBinding to look up paths in bindingPaths, call the
removal API on r.wsMux, and delete the bindingPaths entry.
Related
Requested by
@senthuran16
Summary
AddWebBrokerApiBindinginevent-gateway/gateway-runtime/internal/runtime/runtime.goregisters receivers on
r.wsMuxbut never records the route path inbindingPaths.As a result,
RemoveWebBrokerApiBindingcannot remove the handler from the mux andleaves stale WebSocket routes active after the binding is removed via xDS.
Steps to reproduce
WebBrokerApibinding via xDS — a handler is registered onr.wsMux.RemoveWebBrokerApiBindingis called.r.wsMuxbecause the path was never stored inbindingPathsandr.websubMux.Removeis called instead of a removal onr.wsMux.Required changes
bindingPaths[wbb.Name]insideAddWebBrokerApiBinding.r.wsMuxfrom*http.ServeMuxto a removable mux implementation(e.g., the existing
DynamicMuxtype, same asr.websubMux) so routes can bederegistered.
RemoveWebBrokerApiBindingto look up paths inbindingPaths, call theremoval API on
r.wsMux, and delete thebindingPathsentry.Related
Requested by
@senthuran16