WebSockets demo application using Spring Boot
Demo is working but it's still in progress
It allow you to send echo messages to:
- Same session (same tab in browser)
- All sessions of user you have login
- All sessions of all users
Also you can login as normal user or as administrator
Only administrator can send messages to 'admin' topic
- Java 8
- Maven
- Git
- Clone repository
- Run project from root folder of application:
mvn spring-boot:run
- Go to localhost:8080 in browser to see home page of application
On a home page you will see something like this:
Switch "Connect as admin" allows you to choose STOMP endpoints:
- If it's OFF you will be connected to STOMP endpoint that requires USER rights
- If it's ON you will need ADMIN rights
"Connect" button allows you to create socket connection
"Disconnect" button used to destroy connection
After pressing connect button browser will ask you for credentials
Default user credentials are:
- username: user
- password: userpassword
Default admin credentials are: - username: admin
- password: adminpassword
You can check or change it in net.evgenibers.wsd.services.security.MockedUserDetailsService
After that you can send echo messages to different topics (user, session, all, admin)
Received messages will be shown in the table "Messages"
Message template is: "date-time" "username": "message_text"
https://spring.io/guides/gs/messaging-stomp-websocket
https://en.wikipedia.org/wiki/Streaming_Text_Oriented_Messaging_Protocol
https://www.baeldung.com/spring-security-websockets
https://www.baeldung.com/spring-websockets-sendtouser
http://jmesnil.net/stomp-websocket/doc/
https://docs.spring.io/spring-security/site/docs/5.2.x/reference/html/web-app-security.html#websocket