-
Notifications
You must be signed in to change notification settings - Fork 97
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
How does the client receive messages sent by the server #240
Labels
needs triage
Issue/PR needs triage by a project maintainer
Comments
Hi @sdack-cloud , are you able to provide any additional information into what issue you are having? |
clientRSocket = RSocketConnector.create()
.metadataMimeType(WellKnownMimeType.MESSAGE_RSOCKET_COMPOSITE_METADATA.string)
.dataMimeType(WellKnownMimeType.APPLICATION_JSON.string)
.setupPayload(DefaultPayload.create("ttest"))
.acceptor(
SocketAcceptor.forRequestResponse { payload: Payload ->
val route: String? = decodeRoute(payload.sliceMetadata())
payload.release()
if ("message" == route) {
val meta = MetaVo.Meta.parseFrom(payload.data)
Log.e("MESSAGE", meta.toString())
Mono.just(meta)
}
Mono.error(IllegalArgumentException("Route $route not found"))
}
)
.keepAlive(Duration.ofSeconds(30), Duration.ofMinutes(30))
.reconnect(Retry.fixedDelay(4, Duration.ofSeconds(5)))
.block() this.connector = new RSocketConnector({
setup: {
keepAlive: 5 * 1000,
lifetime: 10 * 1000, //存活时长 毫秒
dataMimeType: WellKnownMimeType.APPLICATION_CBOR.string,
metadataMimeType: WellKnownMimeType.MESSAGE_RSOCKET_COMPOSITE_METADATA.string,
// dataMimeType: "application/octet-stream",
// metadataMimeType: 'message/x.rsocket.composite-metadata.v0',//message/x.rsocket.composite-metadata.v0
payload: {
data: Buffer.from("vue"),
// metadata: encodeSimpleAuthMetadata("user","pass"),
}
},
responder: {
accept: () => ({
requestResponse: (payload) => {
console.log("payload")
}
})
},
transport: new WebsocketClientTransport({
debug: true,
url: 'ws://localhost:7002',
}),
});
this.connector
.connect()
.then((res) => {
console.log("connect", res)
this.rsocketRequester = res;
window.rsocketRequester = res;
this.rsocketRequester.onClose((err) => {
console.log("CLOSE", err)
})
}).catch((err) => {
console.error("connect", err);
}); How does the JS client receive routing messages ,Like Java acceptor(), it receives the information from the server There are too few examples. Can you add some examples |
sdack-cloud
changed the title
Websocketclient receives routing message
How does the client receive messages sent by the server
Aug 26, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Websocketclient receives routing message
The text was updated successfully, but these errors were encountered: