将框架用作 WebSocket 客户端 [英] Play Framework as a WebSocket Client
问题描述
我使用的是 Play 2.3,正在查看使用 Akka 作为 WebSocket 服务器的文档.但是在文档中他们没有说明 Play 是否可以连接到现有的 WebSocket 服务器.基本上我有兴趣成为一个 WebSocket 客户端,他将从 WebSocket 服务器接收消息.我的 Play 应用程序将使用此 WebSocket 服务器进行双向请求/响应,然后最后我将启动终止.
I am using Play 2.3, was checking out the documentation for using Akka as a WebSocket Server. However in documentation they did not indicate if Play could connect to the existing WebSocket Servers. Basically I am interested in being a WebSocket Client who will receive messages from the WebSocket Server. My Play app will make bidirectional request/response with this WebSocket server then finally I will initiate the termination.
Play with Akka 可以实现吗?
Is this possible with Play with Akka?
推荐答案
并非如此.目前它只充当服务器.
Not as it stands. Currently it only acts as a server.
你可以做的是使用像 jetty 这样的客户端来自 Play 本身的 websocket,然后按照您认为合适的方式处理数据.
What you could do is use a client like jetty websocket from Play itself, and then process the data as you see fit.
这篇关于将框架用作 WebSocket 客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!