problem: WS proxy uses binary frames (#182)
fix: #180 (cherry picked from commit 2dcb56e8c4467cfdc549fe918427fce593703ca3)
This commit is contained in:
13
demo/test.html
Normal file
13
demo/test.html
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<html>
|
||||||
|
<script src="https://cdn.ethers.io/lib/ethers-5.2.umd.min.js"
|
||||||
|
type="application/javascript">
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script type="application/javascript">
|
||||||
|
provider = new ethers.providers.WebSocketProvider("ws://127.0.0.1:9080/eth");
|
||||||
|
provider.getBlockNumber().then((blockNumber) => {
|
||||||
|
console.log("from dshackle", blockNumber);
|
||||||
|
}).catch(console.warn);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -27,7 +27,6 @@ import io.emeraldpay.dshackle.rpc.NativeSubscribe
|
|||||||
import io.emeraldpay.etherjar.rpc.json.RequestJson
|
import io.emeraldpay.etherjar.rpc.json.RequestJson
|
||||||
import io.emeraldpay.etherjar.rpc.json.ResponseJson
|
import io.emeraldpay.etherjar.rpc.json.ResponseJson
|
||||||
import io.netty.buffer.ByteBufInputStream
|
import io.netty.buffer.ByteBufInputStream
|
||||||
import io.netty.buffer.Unpooled
|
|
||||||
import org.reactivestreams.Publisher
|
import org.reactivestreams.Publisher
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import reactor.core.publisher.Flux
|
import reactor.core.publisher.Flux
|
||||||
@@ -74,9 +73,8 @@ class WebsocketHandler(
|
|||||||
val eventHandler = accessHandler.start(req, routeConfig.blockchain)
|
val eventHandler = accessHandler.start(req, routeConfig.blockchain)
|
||||||
|
|
||||||
val responses = respond(routeConfig.blockchain, control, requests, eventHandler)
|
val responses = respond(routeConfig.blockchain, control, requests, eventHandler)
|
||||||
.map { Unpooled.wrappedBuffer(it.toByteArray()) }
|
|
||||||
|
|
||||||
resp.send(responses)
|
resp.sendString(responses, Charsets.UTF_8)
|
||||||
.then()
|
.then()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user