Library8 : Websockets Spring Boot Project with JS Web Client SockJS & Stomp - AlbertProfe/cifojava2022-5 GitHub Wiki
Welcome to the cifojava2022-5 wiki!
Websockets Spring Boot Project with JS Web-Client SockJS & Stomp
Base project
-
Base project:
- Library7 base
- POM with dependencies:
- STOMP websocket
- webjar for SockJS
- Intro to websocket: AWS ApiGateway with Lmabda-DynamoDB NoSQL, slack link
- AWS Lambda with trigger API Websokcet Gateway
-
To work from base-project
- Stomp: Using WebSocket to build an interactive web application
resources/static
JS client- example:
-
WebSocket general sheme
New tools
-
WebSocketConfig
is annotated with@Configuration
to indicate that it is a Spring configuration class. -
@EnableWebSocketMessageBroker
enables WebSocket message handling, backed by a message broker. -
configureMessageBroker(
) method implements the default method in WebSocketMessageBrokerConfigurer to configure the message broker. -
registerStompEndpoints()
method registers the /gs-guide-websocket endpoint, enabling SockJS fallback options so that alternate transports can be used if WebSocket is not available.- The
SockJS
client will attempt to connect to /gs-guide-websocket and use the best available transport (websocket, xhr-streaming, xhr-polling, and so on).
- The
-
WebSocket vs HTTP
Versions
- version 1.0 : very basic project