rsocket-java
rsocket-java copied to clipboard
resume not supported
2022-08-08 21:58:55.982 27203-27265/com.example.rsocket E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-2 Process: com.example.rsocket, PID: 27203 UnsupportedSetupException (0x2): resume not supported at io.rsocket.exceptions.Exceptions.from(Exceptions.java:60) at io.rsocket.core.RSocketRequester.lambda$tryTerminateOnZeroError$4(RSocketRequester.java:313) at io.rsocket.core.-$$Lambda$RSocketRequester$rwbq8EQ-eZ8va-mvaHgd0inROSU.get(Unknown Source:2) at io.rsocket.core.RSocketRequester.tryTerminate(RSocketRequester.java:318) at io.rsocket.core.RSocketRequester.tryTerminateOnZeroError(RSocketRequester.java:313) at io.rsocket.core.RSocketRequester.handleStreamZero(RSocketRequester.java:224) at io.rsocket.core.RSocketRequester.handleIncomingFrames(RSocketRequester.java:209) at io.rsocket.core.RSocketRequester.lambda$kDn7LIfo960b6cXO3SLu8QVkTAE(Unknown Source:0) at io.rsocket.core.-$$Lambda$RSocketRequester$kDn7LIfo960b6cXO3SLu8QVkTAE.accept(Unknown Source:4) at reactor.core.publisher.LambdaSubscriber.onNext(LambdaSubscriber.java:160) at io.rsocket.core.ClientServerInputMultiplexer$InternalDuplexConnection.onNext(ClientServerInputMultiplexer.java:248)
Spring dependency rsocket:1.1.2
spring log
2022-08-09 07:36:58.259 DEBUG 46773 --- [ctor-http-nio-6] io.rsocket.FrameLogger : sending -> UnsupportedSetupException: resume not supported
My connection example
GlobalScope.launch {
val transport = WebsocketClientTransport.create(URI.create("ws://192.168.43.40:7002"))
// try {
if (clientRSocket == null || !clientRSocket!!.isDisposed) {
Log.e("TAG", "连接中。。。" )
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)))
.resume(Resume().retry(Retry.fixedDelay(4, Duration.ofSeconds(5))))
// .resume(Resume().retry(Retry.backoff(Long.MAX_VALUE, Duration.ofSeconds(1))
// .maxBackoff(Duration.ofSeconds(16))
// .jitter(1.0)))
.connect(transport)
.doOnSuccess {
Log.e("TAG", "Success")
}
.doOnCancel {
Log.e("TAG", "Cancel")
}
.doOnError {
Log.e("TAG", "Error")
it.printStackTrace()
}.doFinally {
Log.e("TAG", "Finally")
}
.block()
}
// } catch (e :Exception) {
// Log.e("Exception", "" )
// e.printStackTrace()
// }
if (clientRSocket != null) {
clientRSocket!!
.onClose()
.doOnSuccess {
Log.e("CLOSE", "Success")
}
.doOnCancel {
Log.e("CLOSE", "Cancel")
}
.doOnError {
Log.e("CLOSE", "Error")
it.printStackTrace()
}
.doFinally {
Log.e("CLOSE", "Finally")
}
.block()
}
}
Can you give me some guidance
How to write resume()
Retry exception causes Android program crash
2022-08-09 08:11:31.320 8849-9069/com.example.rsocket E/TAG: 连接中。。。 2022-08-09 08:11:46.957 8849-9075/com.example.rsocket E/TAG: Error 2022-08-09 08:11:46.974 8849-9075/com.example.rsocket E/TAG: Finally 2022-08-09 08:11:47.011 8849-9069/com.example.rsocket E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-1 Process: com.example.rsocket, PID: 8849 reactor.core.Exceptions$RetryExhaustedException: Retries exhausted: 3/3
@sdack-cloud which rsocket version are you using? Can you also prepare a small application that can reproduce that in an isolated environment? Also, it is unclear what is the server setup which handles your connection. Please provide a bit more info so we can help to resolve your issue.
Thanks
Android
rsocket v: 1.1.3
https://github.com/sdack-cloud/rscoker-android-test.git
Server
spring-rsocket-sample
id 'org.springframework.boot' version '2.7.2' id 'io.spring.dependency-management' version '1.0.12.RELEASE' implementation 'org.springframework.boot:spring-boot-starter-rsocket'
websocket
@ConnectMapping
fun connect(requester: RSocketRequester, @Payload client: String?) {
requester.rsocket()
?.onClose()
?.doFirst {
log.info("Client: {} CONNECTED. Count: {}", client, clients.size)
if (client == null || client.isBlank()) {
requester.dispose()
return@doFirst
}
if (clients[client] != null) {
if (!clients[client]!!.isDisposed) {
clients[client]!!.dispose()
}
}
clients[client] = requester
log.info("connected. Count: {}", clients.size)
}
?.doOnError {
// Warn when channels are closed by clients
log.warn("Channel to client {} CLOSED. Count: {}", client, clients.size)
clients[client]?.rsocket()?.dispose()
log.warn("closed. Count: {}", clients.size)
}
?.doFinally {
log.warn("Client: {} DISCONNECTED. Count: {}", client, clients.size)
clients.remove(client)
log.warn("disconnected Count: {}", clients.size)
}
?.subscribe()
}
result
An exception occurred while connecting
UnsupportedSetupException (0x2): resume not supported
@OlegDokuka