如何手动测试lagom websocket API?

How to manually test lagom websocket API?

我下载了包含简单 websocket 端点的 Lagom 示例项目 named("example-stream") .withCalls( namedCall("stream", stream) ).withAutoAcl(true) 当我启动应用程序并尝试打开 websocket 连接 (ws://localhost:9000/stream) 时,服务器日志打印:

[warn] akka.actor.ActorSystemImpl [sourceThread=application-akka.actor.default-dispatcher-53, akkaSource=akka.actor.ActorSystemImpl(application), sourceActorSystem=application, akkaTimestamp=18:02:21.293UTC] - HTTP header 'Sec-WebSocket-Extens ions: permessage-deflate' is not allowed in requests 20:02:21.301 [warn] runstats-stream [] - Could not negotiate a deserializer for type MessageProtocolImpl(Some(none/none),None,None), the default media type supported is MessageProtocolImpl(Some(text/plain),Some(utf-8),None)

为此,我使用了名为 Browser Websocket 客户端的 Firefox 插件。据我所知,Websocket 握手不需要或设置显然是 lagom websocket 端点期望的 Content-Type。

是我做错了什么还是生成的项目不知何故无效?

你没有做错任何事。 Lagom 1.4.0 附带了两种不同的 server-side websocket 处理实现(netty vs AkkaHTTP)。 Lagom 中的默认实现是 AkkaHTTP-based,我们最近发现了一个 issue。该解决方案已经制定出来,但在我们发布 Lagom 1.4.1 之前无法使用。

同时,您可以 opt-in 在 migration guide details on how to select a different server engine.

之后 netty-based 实现(过去是默认的)