Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Scala 用Lagom固定腹板箱_Scala_Websocket_Lagom - Fatal编程技术网

Scala 用Lagom固定腹板箱

Scala 用Lagom固定腹板箱,scala,websocket,lagom,Scala,Websocket,Lagom,通过这个框架,我试图连接到Binance的websocket api 但是,我在连接时不断遇到以下错误: 400普通HTTP请求已发送到HTTPS端口 是否可以从Lagom连接到安全的websocket服务?那么WebSocketClient呢? 我有以下代码: trait BinanceStreamingService extends Service { def depthStream(symbol: String): ServiceCall[NotUsed, Source[Depth

通过这个框架,我试图连接到Binance的websocket api

但是,我在连接时不断遇到以下错误:

400普通HTTP请求已发送到HTTPS端口

是否可以从Lagom连接到安全的websocket服务?那么WebSocketClient呢? 我有以下代码:

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")
}

在这里可以找到一个ruuning代码示例:

Lagom的WebSocket客户端还不支持TLS。使用重新实现客户端存在一个未决问题,这将启用TLS支持:

同时,最好的方法是使用或其他支持安全连接的WebSocket客户端库来实现您的客户端