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 send duplicate requests (4) each "keepAlive" interval #182

Open
RejDev opened this issue Sep 4, 2021 · 0 comments
Open

rsocket send duplicate requests (4) each "keepAlive" interval #182

RejDev opened this issue Sep 4, 2021 · 0 comments
Labels
needs triage Issue/PR needs triage by a project maintainer

Comments

@RejDev
Copy link

RejDev commented Sep 4, 2021

Hello everyone,

I don't know if this is normal, but on each cycle (keepAlive interval) rsocket sends duplicate empty requests like this :
(two requests and two responses in same interval)

req > 00000000: 0000 0000 0c80 0000 0000 0000 0000       ..............
res < 00000000: 0000 0000 0c80 0000 0000 0000 0000       ..............
req > 00000000: 0000 0000 0c80 0000 0000 0000 0000       ..............
res < 00000000: 0000 0000 0c80 0000 0000 0000 0000       ..............

for this example , keepAlive = 10000, so every 10 seconds.
What's weird is that these aren't KEEPALIVE Frame (0x03)

rsocket2

Front Code :

const setupOptions = {
  keepAlive: 10000,
  lifetime: 180000,
  dataMimeType: 'application/json', 
  metadataMimeType: 'message/x.rsocket.routing.v0',
};

const transportOptions = {
  url: 'ws://localhost:7000/rsocket',
  wsCreator: (url: string) => {
    return new WebSocket(url);
  },
};

// Create an instance of a client
const rsocketClient = new RSocketClient({
  serializers: { data: JsonSerializer, metadata: IdentitySerializer },
  setup: setupOptions,
  transport: new RSocketWebSocketClient(transportOptions),
});

rsocketClient.connect().subscribe({
      onComplete: (socket) => {
        console.log('Connected');
      },
      onError: (error) => console.error(error),
      onSubscribe: (cancel) => {
        console.log('onSubscribe OK');
      }, 
});

Back Code (it is not important because the problem is in the connection phase) :

@Controller
public class RsocketServerController {
	@Autowired
	ObjectMapper objectMapper;

	@SuppressWarnings("unused")
	private static final Logger log = LoggerFactory.getLogger(RsocketServerController.class);

	private static final Map<String, RSocketRequester> REQUESTER_MAP = new HashMap<>();

	@MessageMapping("sayHello") // request-response
	Mono<String> sayHello(/* @Payload */ String message) { // Hooks.onErrorDropped(()->{}) ;
		System.out.println("Received request-response message: {}" + message);

		String response;
		try {
			response = objectMapper.writeValueAsString("You said: " + message);
			return Mono.just(response).log();
		} catch (JsonProcessingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Mono.empty();
		}

	}
}

Network activity :

Environment + RSocket version(s) used:

OS:
Linux: Manjaro

Front:
VueJs 3
Webpack 5 + Typescript
"@types/rsocket-core": "^0.0.7",
"@types/rsocket-tcp-client": "^0.0.1",
"@types/rsocket-websocket-client": "^0.0.4",
"@types/sockjs-client": "^1.5.1",

Back :
openjdk version "16.0.2" 2021-07-20
OpenJDK Runtime Environment (build 16.0.2+7)
OpenJDK 64-Bit Server VM (build 16.0.2+7, mixed mode)
'org.springframework.boot' version '2.5.4'
+
implementation 'org.springframework.boot:spring-boot-starter-rsocket'
implementation 'org.springframework.boot:spring-boot-starter-websocket'
implementation 'org.springframework.boot:spring-boot-starter-webflux'

@viglucci viglucci added the needs triage Issue/PR needs triage by a project maintainer label Mar 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Issue/PR needs triage by a project maintainer
Projects
None yet
Development

No branches or pull requests

2 participants