Hey guys,
Should it be possible from Lagom to connect to a secure websocket service? So with WebSocketClient?
The following:
trait BinanceStreamingService extends Service {
def depthStream(symbol: String): ServiceCall[NotUsed, Source[DepthEvent, NotUsed]]
override final def descriptor = {
import Service._
import me.koopal.crypto.api.BinanceModelsMarshallers._
named("depth-stream")
.withCalls(
restCall(GET, "/ws/:symbol@deth", depthStream _)
)
}
}
private val binanceStreamApplication = new LagomClientApplication("binance-ws")
with StaticServiceLocatorComponents
with AhcWSComponents {
override def staticServiceUri = URI.create("wss://stream.binance.com:9443")
}
override def stream = ServiceCall { _ =>
binanceStreamClient.depthStream("bnbbtc")
.invoke()
.map { s =>
s.runForeach(e => println(e))
}.onComplete {
case Success(x) => println("success", x)
case Failure(ex) => println("failure", ex)
}
Future.successful("test")
}
Gives me:
(failure,com.lightbend.lagom.scaladsl.api.transport.DeserializationException: <html>
<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<center>The plain HTTP request was sent to HTTPS port</center>
</body>
</html>
Am I missing something here?