Advertisement
gitahinganga

Web Socket Config

Jun 28th, 2022
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1. @Configuration
  2. @EnableWebSocketMessageBroker
  3. public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
  4.  
  5.     @Override
  6.     public void configureMessageBroker(MessageBrokerRegistry config) {
  7.         config.enableSimpleBroker("/topic");
  8.         config.setApplicationDestinationPrefixes("/app");
  9.     }
  10.  
  11.     @Override
  12.     public void registerStompEndpoints(StompEndpointRegistry stompEndpointRegistry) {
  13.         stompEndpointRegistry.addEndpoint("/chat")
  14.             .setHandshakeHandler(new DefaultHandshakeHandler(new TomcatRequestUpgradeStrategy()))
  15.             .withSockJS();
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement