问题描述
我一直在使用以下链接来使用新的 spring 4 websockets:
Iv'e been using the following link in order to play with the new spring 4 websockets:
http://spring.io/guides/gs/messaging-stomp-websocket/
我想知道是否必须使用 stomp broker 才能使用 spring 框架?有没有经纪人更少的方式来使用它?
I was wondering if i must use a stomp broker in order to use the spring framework ? is there any broker less way to use it?
谢谢
推荐答案
本指南使用的是 Spring 框架中提供的简单代理实现.它只是一段 Java 代码来扮演这个角色——在该设置中没有实际的代理.所以是的,有一种无需代理的方式来使用它,而您已经在这样做了.
This guide is using the simple broker implementation provided in Spring Framework. It's just a piece of Java code that plays that part - there's no actual broker in that setup. So yes, there is a broker-less way to use this, and you're already doing it.
这个实现虽然缺少很多功能,但您可能希望在生产.
This implementation lacks many features though, and you may want to use a real broker (like RabbitMQ) in production.
您不必必须使用 STOMP 和消息代理,实际上您可以使用 Websocket API 直接.如本演示文稿所述:
You don't have to use STOMP and a message broker, in fact you can use the Websocket API directly. As stated in this presentation:
直接使用 WebSocket API 有点像编写自定义 Servlet应用程序,除了 WebSocket 协议的级别低于 HTTP.
根据您的应用目标,您无论如何都可能会转向消息驱动的应用程序;自己解决不是一件容易的事...
Depending on your app goals, you may go towards a message-driven application anyway; not an easy task to solve on your own...
这篇关于Spring 4 Web 套接字 - 我必须有一个 stomp broker 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!