From 5df10706dd903100050e67ad0912f93d6a0654ac Mon Sep 17 00:00:00 2001 From: Igor Artamonov Date: Fri, 23 Sep 2022 21:18:28 -0400 Subject: [PATCH] problem: WS proxy uses binary frames (#182) fix: #180 (cherry picked from commit 2dcb56e8c4467cfdc549fe918427fce593703ca3) --- demo/test.html | 13 +++++++++++++ .../emeraldpay/dshackle/proxy/WebsocketHandler.kt | 4 +--- 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 demo/test.html diff --git a/demo/test.html b/demo/test.html new file mode 100644 index 00000000..9a44c15a --- /dev/null +++ b/demo/test.html @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/src/main/kotlin/io/emeraldpay/dshackle/proxy/WebsocketHandler.kt b/src/main/kotlin/io/emeraldpay/dshackle/proxy/WebsocketHandler.kt index 3882d05b..b1fb0d7a 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/proxy/WebsocketHandler.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/proxy/WebsocketHandler.kt @@ -27,7 +27,6 @@ import io.emeraldpay.dshackle.rpc.NativeSubscribe import io.emeraldpay.etherjar.rpc.json.RequestJson import io.emeraldpay.etherjar.rpc.json.ResponseJson import io.netty.buffer.ByteBufInputStream -import io.netty.buffer.Unpooled import org.reactivestreams.Publisher import org.slf4j.LoggerFactory import reactor.core.publisher.Flux @@ -74,9 +73,8 @@ class WebsocketHandler( val eventHandler = accessHandler.start(req, routeConfig.blockchain) val responses = respond(routeConfig.blockchain, control, requests, eventHandler) - .map { Unpooled.wrappedBuffer(it.toByteArray()) } - resp.send(responses) + resp.sendString(responses, Charsets.UTF_8) .then() } }