This is a Spring Boot Messaging Example serving different Websockets clients: a Swing client using the the Spring Stomp Java Client and a Javascript client using the stomp.js libarary, with dynamic / selective Endpoints with different ClientExample with dynamic / selective Endpoints. Rabbitmq is used as Relay host for the Stomp Messaging.
Also there is a Spring Boot Server, which uses Spring amqp Messaging to send & retrieve Messages to/from the same Topics as the Websocket Clients
One can send notifications over Stomp to all clients or selective Clients, using a unique id for each Client instance.
The Websockets are unsecured, since i have'nt found out, how to use the Spring Java Stomp Client with secured Websockets.
The Web clients require a login, the Swing client does'nt.
In for example Eclipe
- Start /stomp-server/src/main/java/chat/TestChatServer.java
For the Javascript stomp.js clients
- Open various Browser Instance. Macos in Terminal: open -n /Applications/Safari.app
- http://localhost:8080
- Login either as u01, u11 or u21. With password being same as username
- Connect
- Enter a shout with a to = being a logged in user or to being empty -> to all
- The shout should be displayed, after a couple of secs for the respective user(s)
- Ener a shout with being one of the ids displayed
- The shout should be displayed only for the respective client with the id
For the Swing client
- Run /stomp-swing-client/src/main/java/chat/ChatUi.groovy as Groovy Script
- Similar UI as with the browser
A running Rabbitmq host, with the Stomp Plugin enabled, see also https://www.rabbitmq.com/stomp.html
rabbitmq-plugins enable rabbitmq_stomp
For for Stomp Messaging, see /chat-stomp-server/src/main/java/chat/ChatController.java and /chat-stomp-server/src/main/java/chat/WebSocketRelayConfig.java