Skip to content

Update RequestChannel API and first frame handling#146

Merged
jjeffcaii merged 1 commit intorsocket:masterfrom
echistyakov:update-request-channel-api
Feb 12, 2026
Merged

Update RequestChannel API and first frame handling#146
jjeffcaii merged 1 commit intorsocket:masterfrom
echistyakov:update-request-channel-api

Conversation

@echistyakov
Copy link
Contributor

Modify RequestChannel API to handle the initial frame/request separately from Flux for the subsequent frames.

Motivation:

(a) The new API is consistent with all other RSocket methods (which take initial Payload as the first argument):

https://github.com/echistyakov/rsocket-go/blob/2347d764aefcc0f5584c98a88e5a0637b9e22a0c/internal/socket/abstract_socket.go#L21-L24

(b) The new API fixes a client-side inefficiency/bug for the following case:

  1. RQ -> RS: REQUEST_CHANNEL
  2. RS -> RQ: REQUEST_N <---- Bug!
  3. RS -> RQ: ERROR

With the old API - the server (RS) would subscribe to the sending Flux before (!!!) seeing the first frame:
https://github.com/echistyakov/rsocket-go/blob/2347d764aefcc0f5584c98a88e5a0637b9e22a0c/internal/socket/duplex.go#L642-L646
This would send a REQUEST_N frame to the client, making client "think" that the server was requesting additional payloads, even though the server would respond with an ERROR soon after.
With the new API - the server (RS) can receive and process the initial request first, before deciding whether to subscribe or respond with ERROR or COMPLETE or REQUEST_N frame.

Modifications:

  1. Updated RequestChannel method signatures to take Payload as the first argument.
  2. Updated logic in duplex.go and subscriber_request_channel.go to handle the initial frame similarly to RequestStream (outside of Flux).

Result:

Flux is now only used for "subsequent" payloads.
The initial REQUEST_CHANNEL payload is handled separately - allowing the server to inspect the initial request before taking any action on the Flux.

@echistyakov echistyakov marked this pull request as draft February 11, 2026 01:07
@echistyakov echistyakov force-pushed the update-request-channel-api branch 3 times, most recently from 85a1a38 to 6137590 Compare February 11, 2026 05:19
@echistyakov echistyakov force-pushed the update-request-channel-api branch from 6137590 to d122168 Compare February 11, 2026 05:25
@echistyakov echistyakov marked this pull request as ready for review February 11, 2026 05:29
Copy link
Member

@jjeffcaii jjeffcaii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jjeffcaii
Copy link
Member

Great work on the code, thanks for the PR!

@jjeffcaii jjeffcaii merged commit a9a01ec into rsocket:master Feb 12, 2026
1 of 2 checks passed
meta-codesync bot pushed a commit to facebook/fbthrift that referenced this pull request Feb 12, 2026
Summary: rsocket/rsocket-go#146

Reviewed By: podtserkovskiy

Differential Revision: D93109728

fbshipit-source-id: 29de69ecfead9341ff39291fa8a3156f9768f17f
meta-codesync bot pushed a commit to facebook/hhvm that referenced this pull request Feb 12, 2026
Summary: rsocket/rsocket-go#146

Reviewed By: podtserkovskiy

Differential Revision: D93109728

fbshipit-source-id: 29de69ecfead9341ff39291fa8a3156f9768f17f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments