Skip to content

Duplex interactions #216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 4, 2017
Merged

Conversation

NiteshKant
Copy link
Contributor

Problem

Duplex interactions (server sending requests to the client) are broken.

Modification

  • ReactiveSocketServer wasn't using ClientServerInputMultiplexer to split input into client and server sockets. This made the responses sent from the client to not reach ClientReactiveSocket. Modified ReactiveSocketServer to use ClientServerInputMultiplexer.
  • ClientReactiveSocket didn't handle a request-stream/channel request before transport subscription arrived. Now using a buffering subscription to buffer request-n and cancel till transport subscription arrives.
  • Added DuplexClient example to demonstrate duplex interactions.

Result

Duplex interactions works!

#### Problem

Duplex interactions (server sending requests to the client) are broken.

#### Modification

- `ReactiveSocketServer` wasn't using `ClientServerInputMultiplexer` to split input into client and server sockets. This made the responses sent from the client to not reach `ClientReactiveSocket`. Modified `ReactiveSocketServer` to use `ClientServerInputMultiplexer`.
- `ClientReactiveSocket` didn't handle a request-stream/channel request before transport subscription arrived. Now using a buffering subscription to buffer request-n and cancel till transport subscription arrives.
- Added `DuplexClient` example to demonstrate duplex interactions.

#### Result

Duplex interactions works!
@NiteshKant
Copy link
Contributor Author

\cc @benjchristensen

@benjchristensen
Copy link
Contributor

Since I don't know the surrounding code super well, I have to trust you on most of this.

For example, startReceivingRequests smells somewhat to me since it's a mixture of functional style and imperative side-effecting changes. An imperative function call eagerly triggers a subscribe, which then doOnsubscribe captures and side-effects by assigning that subscription. That confuses me as to why the functional style is used at all in there.

However, it seems to fix the problem so should be merged.

@benjchristensen benjchristensen merged commit f419554 into rsocket:0.5.x Jan 4, 2017
Throwable::printStackTrace,
StreamIdSupplier.serverSupplier(),
KeepAliveProvider.never());
LeaseHonoringSocket lhs = new DefaultLeaseHonoringSocket(sender);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The oddity here is that there is no way today in the protocol where a server can tell whether it will honor leases from the client. Probably this should piggy back on the client will honor lease in the setup saying if a client honors lease, server will too.
I am interested in hearing what others think about this.

Copy link
Contributor

Choose a reason for hiding this comment

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

@tmontgomery Your input would be useful on this I imagine.

Copy link
Contributor

Choose a reason for hiding this comment

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

Does it even make sense for a client responder to use leases? Either it can take requests or it can't (reject/fail). For example, a server-mobile relationship doesn't make sense for leases, as once a mobile client is connected, it only has that one connection to send requests over. Leases really only make sense in server-server situations where a requesting server has multiple connections open and can send requests to different servers depending on their leases.

Copy link
Member

Choose a reason for hiding this comment

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

I think it's an oversight.
We could decide that the server will match the configuration of the client.

@NiteshKant NiteshKant deleted the 0.5.x-duplex branch January 4, 2017 18:32
@stevegury
Copy link
Member

👍

ilayaperumalg pushed a commit to ilayaperumalg/rsocket-java that referenced this pull request Dec 26, 2017
Revision of how request fragmentation will be done with PAYLOAD frames as per discussion in rsocket/rsocket#198
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants