Library8 : Websockets Spring Boot Project with JS Web Client SockJS & Stomp
Albert edited this page Jun 28, 2022
·
5 revisions
Welcome to the cifojava2022-5 wiki!
-
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
-
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
- version 1.0 : very basic project