WebSocket with Spring Boot and Java | Build a Chat App
HTML-код
- Опубликовано: 7 фев 2025
- Welcome to our tutorial on creating a real-time chat application using WebSockets with Java and Spring Boot! In this video, we'll guide you step-by-step through the process of setting up WebSockets in a Spring Boot application, allowing for seamless, real-time communication between clients and the server.
What You'll Learn:
• Introduction to WebSockets and their advantages for real-time communication.
• Setting up a Spring Boot project from scratch.
• Configuring WebSocket support in Spring Boot.
• Creating the necessary controllers and services for message handling.
• Building a simple chat application.
• Testing and deploying your chat application.
Source Code - github.com/Cod...
🔔 Don't forget to Like, Comment, and Subscribe for more programming tutorials!
#SpringBoot #Java #WebSockets #RealTimeApp #ChatApp #ProgrammingTutorial #WebDevelopment
Thankyou for this. Best video on spring websocket so far.
Can you please tell me on how to switch to wss from ws using SSL. (I am using spring websocket without stomp & sockjs)
Thanks for your kind comments. Switching to SSL is straight forward
For dev environment you can first create a self signed certificate using the below command. For production, it's recommended to obtain a certificate from a trusted CA.
keytool -genkeypair -alias websocket -keyalg RSA -keysize 2048 -storetype PKCS12 -keystore websocket.p12 -validity 3650
Add the below to application.properties
server.ssl.key-store=file:/websocket.p12
server.ssl.key-store-password=
server.ssl.keyStoreType=PKCS12
server.ssl.keyAlias=websocket
server.ssl.enabled=true
After that you can access the websocket using url starting with wss://
its just a very good video. Thanks
Thanks for your kind feedback
but i have a question: so how we can test 2nd version of your example with postman? Is it absolutly impossible? or is it just hard and inconveniently?
Since the second one uses STOMP protocol on top of Websocket, I think it might not work since there are no options in postman to enable that. Will try to explore more.
@@Code.Wizzard so it is a case to create simple html page to test your backend app, right?
Or maybe is there an ability to write integration tests for this purpose?
@@OleksandrProkopenko_ua correct, either can test it from a UI or write integration test using WebSocketStompClient