From 2bedcad9dc5ec987ca20e11974d284f8e250e816 Mon Sep 17 00:00:00 2001 From: KirillPamPam Date: Fri, 29 Mar 2024 19:25:43 +0400 Subject: [PATCH] Fix proxy newHeads sub (#446) --- .../io/emeraldpay/dshackle/proxy/WebsocketHandler.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/io/emeraldpay/dshackle/proxy/WebsocketHandler.kt b/src/main/kotlin/io/emeraldpay/dshackle/proxy/WebsocketHandler.kt index e83876e03..6a4a7304a 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/proxy/WebsocketHandler.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/proxy/WebsocketHandler.kt @@ -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)