Skip to content
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

When empty result returned for RequestResponse, nothing happened on client side #150

Closed
kevinat opened this issue Jul 7, 2021 · 2 comments

Comments

@kevinat
Copy link

kevinat commented Jul 7, 2021

We are using Spring RSocket, when server returns an Mono.empty() in RequestResponse, none of the Single subscriber callbacks invoked, so we don't known whether the request is finished.

Is there any possible to trigger the onComplete callback with an undefined argument when the RSocket stream completed while RequestResponse?

@kevinat
Copy link
Author

kevinat commented Jul 7, 2021

#89
Same problem caused by client callback mechanism.

I found the code associated: RSocketMachine.js at line 305
https://github.com/rsocket/rsocket-js/blob/master/packages/rsocket-core/src/RSocketMachine.js#L305

  requestResponse(payload: Payload<D, M>): Single<Payload<D, M>> {
    const leaseError = this._useLeaseOrError(this._requesterLeaseHandler);
    if (leaseError) {
      return Single.error(new Error(leaseError));
    }

    const streamId = this._getNextStreamId(this._receivers);
    return new Single(subscriber => {
      this._receivers.set(streamId, {
        onComplete: () => {},
        onError: error => subscriber.onError(error),
        onNext: data => subscriber.onComplete(data),
      });

May be this is better:

    return new Single(subscriber => {
      this._receivers.set(streamId, {
        onComplete: () => subscriber.onComplete(),
        onError: error => subscriber.onError(error),
        onNext: data => subscriber.onNext(data),
      });

I don't think it's a problem to receive data from onNext. On the contrary, this may be the right "Reactive" way.

@kevinat
Copy link
Author

kevinat commented Jul 7, 2021

#78
Sorry, same issue.

@kevinat kevinat closed this as completed Jul 7, 2021
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

No branches or pull requests

1 participant