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

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).
  • WebSocket vs HTTP

    WebSocket vs HTTP

Versions