Overview A sample demonstrating capabilities in the Spring Framework to build WebSocket-style messaging applications. The application uses …
Overview A sample demonstrating capabilities in the Spring Framework to build WebSocket-style messaging applications. The application uses …
A sample demonstrating capabilities in the Spring Framework to build WebSocket-style messaging applications. The application uses STOMP (over WebSocket) for messaging between browsers and server and SockJS for WebSocket fallback options.
Client-side libraries used:
Server-side runs on Tomcat, Jetty, WildFly, Glassfish, and other Servlet 3.0+ containers with WebSocket support.
For Tomcat, set TOMCAT_HOME as an environment variable and use deployTomcat.sh and shutdownTomcat.sh in this directory.
Open a browser and go to
The easiest way to run on Jetty is with mvn jetty:run.
Open a browser and go to
Note: To deploy to a Jetty installation, add this to Jetty's start.ini:
OPTIONS=plus
etc/jetty-plus.xml
OPTIONS=annotations
etc/jetty-annotations.xmlUnzip the WildFly server.
Set WILDFLY_HOME as an environment variable and use deployWildFly.sh in this directory.
Open a browser and go to
Build and deploy with the following server configuration:
jsp-2.3
webSocket-1.1After unzipping Glassfish 4 start the server:
/glassfish4/bin/asadmin start-domainSet GLASSFISH4_HOME as an environment variable and use deployGlassfish.sh in this directory.
Open a browser and go to
Out of the box, a "simple" message broker is used to send messages to subscribers (e.g. stock quotes) but you can optionally use a fully featured STOMP message broker such as RabbitMQ, ActiveMQ, and others, by following these steps:
MessageBrokerConfigurer in WebSocketConfig.java to enable the STOMP broker relay instead of the simple broker.relayHost, relayPort, systemLogin, systemPassword, depending on your message broker. The default settings should work for RabbitMQ and ActiveMQ.To see all logging, enable TRACE for org.springframework.messaging and org.springframework.samples in log4j.xml.
Keep in mind that will generate a lot of information as messages flow through the application. The QuoteService for example generates a lot of messages frequently. You can modify it to send quotes less frequently or simply comment out the @Scheduled annotation.
No open issues yet, or sync has not completed.