You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Move remote request handling into core behind the remote-adapter feature flag #774
Move the duplicated remote-request handling from the redis, postgres and mongodb
adapters into socketioxide_core behind the existing remote-adapter feature flag.
Current state: each adapter implements a near-identical recv_req dispatch plus the
same recv_* handlers (~110 LOC per adapter): broadcast, broadcast_with_ack,
disconnect_sockets, all_rooms, add/del sockets, fetch sockets. Each also repeats the
same get_res / broadcast_with_ack skeleton (response channel setup, ResponseHandlers insert, ResponseTypeId filter, take(remote_serv_cnt), request
timeout).
A shared trait in core (RemoteRequestHandler<E> behind remote-adapter) with default implementations of the recv_req dispatch plus all 7 recv_* handlers (~150 LOC once instead of 3 times). Each adapter only implements local() (the CoreLocalAdapter, which covers everything the handlers use, including uid/ns/ack_timeout for the logs), send_res and an overridable recv_heartbeat hook (no-op by default, postgres and mongodb delegate to the HeartbeatSender logic from #768). Redis keeps a tiny decode-and-delegate wrapper, postgres and mongodb just delete their copies.
A small response-wait helper covering the identical get_res tail (channel sizing + ResponseHandlers insert + ResponseTypeId filter + take(serv_cnt) + timeout) and wrapping uniformly in DropStream. Btw this also fixes a leak: postgres is the only adapter whose get_res doesn't wrap in DropStream, so its rooms/fetch handler entries pile up in the map forever. Happy to split that fix into its own commit if you prefer.
Some normalizations (tiny differences, picked on purpose):
send_res unified to (req_id, req_origin) arg order plus the strictest bounds (T: Serialize + Debug + Send + 'static, future + Send + 'static), redis's inverted order is handled inside its impl
missing opts on a request: warn and skip everywhere (redis already does, postgres and mongodb silently drop it right now)
loopback self-check moved inside the shared dispatch (redis had it there, postgres and mongodb filter earlier so it's a no-op for them)
logs normalized to one style
Deferred to the codec PR: sharing the outbound broadcast_with_ack body, it needs associated types for the raw response item + decoder which belong with the codec work.
One thing i noticed while i was in there, not touched by this PR: redis's broadcast_with_ack passes opts.server_id as the send target but always uses server_count - 1 as the expected ack count, so a targeted broadcast's ack stream completes by timeout instead of cleanly. Flagging it in case you want a separate issue for it.
Activity
LiamCarPer commentedon Aug 23, 2026
Hey, here is what i was thinking for this PR:
A shared trait in core (
RemoteRequestHandler<E>behindremote-adapter) with default implementations of therecv_reqdispatch plus all 7recv_*handlers (~150 LOC once instead of 3 times). Each adapter only implementslocal()(theCoreLocalAdapter, which covers everything the handlers use, including uid/ns/ack_timeout for the logs),send_resand an overridablerecv_heartbeathook (no-op by default, postgres and mongodb delegate to theHeartbeatSenderlogic from #768). Redis keeps a tiny decode-and-delegate wrapper, postgres and mongodb just delete their copies.A small response-wait helper covering the identical
get_restail (channel sizing +ResponseHandlersinsert +ResponseTypeIdfilter +take(serv_cnt)+ timeout) and wrapping uniformly inDropStream. Btw this also fixes a leak: postgres is the only adapter whoseget_resdoesn't wrap inDropStream, so its rooms/fetch handler entries pile up in the map forever. Happy to split that fix into its own commit if you prefer.Some normalizations (tiny differences, picked on purpose):
send_resunified to(req_id, req_origin)arg order plus the strictest bounds (T: Serialize + Debug + Send + 'static, future+ Send + 'static), redis's inverted order is handled inside its imploptson a request: warn and skip everywhere (redis already does, postgres and mongodb silently drop it right now)Deferred to the codec PR: sharing the outbound
broadcast_with_ackbody, it needs associated types for the raw response item + decoder which belong with the codec work.One thing i noticed while i was in there, not touched by this PR: redis's
broadcast_with_ackpassesopts.server_idas the send target but always usesserver_count - 1as the expected ack count, so a targeted broadcast's ack stream completes by timeout instead of cleanly. Flagging it in case you want a separate issue for it.Totodore commentedon Aug 29, 2026
Seems good to me, please make a separate PR redis bug fix.