Skip to content

Support Next/Complete payloads#148

Merged
jjeffcaii merged 1 commit intorsocket:masterfrom
echistyakov:support-next-complete-payloads
Mar 18, 2026
Merged

Support Next/Complete payloads#148
jjeffcaii merged 1 commit intorsocket:masterfrom
echistyakov:support-next-complete-payloads

Conversation

@echistyakov
Copy link
Contributor

Support sending a payload with both Next and Complete flags.

Motivation:

Currently - it's impossible to send a payload with both Next and Complete flags when using RequestChannel subscriber.
OnNext callback sends the payload with Next flag, and OnComplete payload sends an empty payload with a Complete flag.
But that's two separate payloads, not one.

Setting both Next and Complete flags on the final payload is totally valid (as per RSocket spec).

And some implementations (such as Thrift RSocket in C++) in fact require the ability to set both Next and Complete flags on a payload for certain use cases:
https://github.com/facebook/fbthrift/blob/8679ad11edc2a79afa602a55ac4839c524ca36e0/thrift/lib/cpp2/transport/rocket/client/RocketClient.cpp#L699-L700

Modifications:

Add a FinalPayload wrapper and some simple logic to allow the user to send a payload with both Next and Complete flags.
The behavior is equivalent to calling OnNext and OnComplete, but only one payload is sent.

Result:

The modification allows for interoperability of rsocket-go with other rsocket implementations and removed the limitation on Next/Complete flags being set on a payload.

@echistyakov
Copy link
Contributor Author

cc @jjeffcaii

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 jjeffcaii merged commit dae9c32 into rsocket:master Mar 18, 2026
1 of 2 checks passed
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