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

RSocket and transport out of sync #140

Open
chacent opened this issue Jun 2, 2021 · 3 comments
Open

RSocket and transport out of sync #140

chacent opened this issue Jun 2, 2021 · 3 comments
Labels

Comments

@chacent
Copy link

chacent commented Jun 2, 2021

i have a rsocket instance

when i call requestChannel without any data send, actually request(on the other side) won't be occured.

similar when transport of the rsocket has been gone,and call requestChannel , the subscribe (on the local side) occured where i just want some error been raised

@chacent chacent changed the title RSocket is not equal transport RSocket and transport out of sync Jun 2, 2021
@OlegDokuka
Copy link
Member

OlegDokuka commented Jun 2, 2021

Hi @chacent!

Thank you for writing. Do you have any core which reproduces the issue? Also, can you specify the RSOcket-Js version you have this issue reproducible?

In general, this was fixed by #117

@chacent
Copy link
Author

chacent commented Jun 3, 2021

thanks for answer,i used v0.0.25

const { RSocketServer , BufferEncoders,RSocketClient } = require('rsocket-core');
const RSocketTCPServer = require('rsocket-tcp-server').default;
const  RSocketTCPClient = require('rsocket-tcp-client').default;
const {Flowable} = require('rsocket-flowable');

new RSocketServer({
	transport:new RSocketTCPServer({port: 80}, BufferEncoders),
	getRequestHandler(rsocket, payload){
		let subscriber;
		rsocket.requestChannel(new Flowable(subscriber=>{
			subscriber.onSubscribe({
				request: (n) => {
					console.log('request occured');
					// @bug if i don't call onNext, client will not receive request channel
					// subscriber.onNext({data:Buffer.alloc(0)});
					debugger
				},
				cancel(){
					debugger
				}
			});
		})).subscribe({
			onComplete: () => console.log('complete'),
			onError: err => console.log(err),
			onNext:x=>{
				console.log(x.data);
				subscriber.request(1);
			},
			onSubscribe: x =>{
				subscriber = x;
				subscriber.request(1);
			}
		});
	}
}).start();

(async(options)=>{
	const client = await new RSocketClient({
		setup: {
			dataMimeType: 'text/plain',
			keepAlive: 10000,
			lifetime: 86400000,
			metadataMimeType: 'text/plain'
		},
		transport: new RSocketTCPClient({
			host: options.host,
			port: options.port,
		}, BufferEncoders ),
		responder:{
			requestChannel(flowable) {
				console.log('got request');
				debugger// forget return value,just for sample
			}
		}
	}).connect();
})({
	port: 80,
});

@chacent
Copy link
Author

chacent commented Jun 3, 2021

and i want to know how i can get current state of rsocket , except for subscribe connectStatus,there is no event style mechanism?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants