【发布时间】:2015-12-10 05:04:15
【问题描述】:
我有一个 Spring 应用程序,它通过 Spring WebSocket 异步向另一台服务器发送消息。但是对于我需要同步发送消息的特定情况,我应该使用来自服务器的传入响应继续该过程。
我不想只为此进程进行 HTTP 调用,因为已经有一个打开的 TCP 连接,我想使用它。
例如在 Tyrus WebSocket 实现中,可以通过同步或异步发送消息
session.getBasicRemote().sendText(message);
session.getAsyncRemote().sendText(message);
Tyrus 相关文档link.
顺便说一句,我不使用 sub-protocol 像带有 Spring WebSocket 的 STOMP。
【问题讨论】:
标签: java spring websocket spring-websocket tyrus