Fix proxy newHeads sub (#446)

This commit is contained in:
KirillPamPam
2024-03-29 19:25:43 +04:00
committed by GitHub
parent 7e9709bb6f
commit 2bedcad9dc

View File

@@ -139,7 +139,12 @@ class WebsocketHandler(
val responses = nativeSubscribe
.subscribe(blockchain, methodParams.first, methodParams.second, io.emeraldpay.dshackle.upstream.Selector.empty)
.map { event ->
WsSubscriptionResponse(params = WsSubscriptionData(event, subscriptionId))
val data = if (event is ByteArray) {
Global.objectMapper.readTree(event)
} else {
event
}
WsSubscriptionResponse(params = WsSubscriptionData(data, subscriptionId))
}
.takeUntilOther(currentControl.asMono())
Flux.concat(Mono.just(start), responses)