我想知道如何定义订阅者路径。
例如订阅路径的声明
stompClient.subscribe("/topic/simplemessagesresponse", function(servermessage) {
为什么有“主题”和“简单消息响应”两部分..它们指的是什么。可以有多少个这样的域部分,为什么?我的问题不仅针对客户端,还针对服务器端。 SimpMessagingTemplate.convertAndSend("/topic/simplemessagesresponse", "给客户端的消息");
有显示 websocket 服务器和客户端示例的教程。但没有足够的规则细节来声明订阅者路径以及如何找到订阅者路径。
在服务器端和客户端声明路径时更改路径有哪些依赖项。我认为另一个similar question 由于编写 websocket 客户端的页面的位置发生变化而引发。
最佳答案
引用 STOMP 规范文档:
Note that STOMP treats this destination as an opaque string and no delivery semantics are assumed by the name of a destination. You should consult your STOMP server's documentation to find out how to construct a destination name which gives you the delivery semantics that your application needs.
这意味着目标语义是特定于代理的:
- 对于 RabbitMQ:查看 STOMP 下的目标部分 插件文档-http://www.rabbitmq.com/stomp.html对于
- 对于 ActiveMQ:查看使用 Stomp 处理目标 - https://activemq.apache.org/stomp.html
关于javascript - 如何定义 Spring WebSocket 订阅者路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25766065/