This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Framework 6.0.26! |
Benefits
Using STOMP as a sub-protocol lets the Spring Framework and Spring Security provide a richer programming model versus using raw WebSockets. The same point can be made about HTTP versus raw TCP and how it lets Spring MVC and other web frameworks provide rich functionality. The following is a list of benefits:
-
No need to invent a custom messaging protocol and message format.
-
STOMP clients, including a Java client in the Spring Framework, are available.
-
You can (optionally) use message brokers (such as RabbitMQ, ActiveMQ, and others) to manage subscriptions and broadcast messages.
-
Application logic can be organized in any number of
@Controller
instances and messages can be routed to them based on the STOMP destination header versus handling raw WebSocket messages with a singleWebSocketHandler
for a given connection. -
You can use Spring Security to secure messages based on STOMP destinations and message types.