Consider the following TS client code snippet below :
this.rSocketClient.connect().subscribe({
onComplete: socket => {
const endpoint = ‚accesscode’;
socket.requestResponse({
data: clientId, //the clientId is a non-empty string
metadata: String.fromCharCode(endpoint.length) + endpoint
}).subscribe({
onComplete: () => console.log(’Done’),
onError: error => {
console.log('Connection has been closed due to:: ' + error);
},
});
},
onError: error => console.error(error),
onSubscribe: cancel => {}
});
I would like to know how the signature of my server accesscode
endpoint should look like. In fact I tried the following solution, but it didn't workout as expected. In fact when I put a breakpoint within getAccessCode
, the call gets caught but clientId
cannot be resolved:
@MessageMapping("accesscode")
public Mono<String> getAccessCode(@Payload String clientId) {
log.info("requested clientId:"+clientId);
//Server side processing to read the corresponding 'accesscode' from the DB
return Mono.just(DefaultPayload.create(accesscode));
}
Any help will be more than appreciated.