Lagom 1.4 可以转发 websocket 错误信息吗?

Can Lagom 1.4 forward websocket error messages?

我在 Lagom 中使用流式服务调用。升级到 1.4 后,来自服务器的错误消息不会通过 websockets 传播到客户端。这在使用 lagomtestkit 的测试中有效,但当 运行 服务使用来自 SBT 的 'runAll' 或在实时部署中时无效。

使用 'runAll',所有失败的客户端调用都会返回 "Peer closed connection with code 1011 'internal error'"

这里的问题很容易诊断。 akka-http 10.0.11 FrameOutHandler 的第 66-68 行创建 WebSocket closeFrame,丢弃传入的异常并返回 "internal error",即使它们有异常消息。

我的问题是,虽然我可以看到错误,但如果不修补 akka-http,我看不到任何简单的修复方法。这是 Lagom 应该支持的东西吗? 1.3以前用netty客户端的时候可以用

您是使用直接连接到服务侦听端口的另一个 Lagom 客户端进行测试,还是使用 Web 浏览器或通过端口 9000 连接的其他客户端进行测试?

如果是后者,您可能还需要将服务网关实现改回 Netty,如 Default gateway implementation 上的文档所述:

The Lagom development environment provides an implementation of a Service Gateway based on Akka HTTP and the (now legacy) implementation based on Netty.

You may opt in to use the old netty implementation.

In the Maven root project pom:

<plugin>
    <groupId>com.lightbend.lagom</groupId>
    <artifactId>lagom-maven-plugin</artifactId>
    <version>${lagom.version}</version>
    <configuration>
        <serviceGatewayImpl>netty</serviceGatewayImpl>
    </configuration>
</plugin>

In sbt:

// Implementation of the service gateway: "akka-http" (default) or
"netty" lagomServiceGatewayImpl in ThisBuild := "netty"

无论如何,请create an issue on GitHub我们可以在框架中研究解决方案。