Advertisement
Guest User

Untitled

a guest
May 25th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. package com.nulpointerexception.npechatroom;
  2.  
  3. import org.springframework.context.annotation.Configuration;
  4. import org.springframework.messaging.simp.config.MessageBrokerRegistry;
  5. import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
  6. import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
  7. import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
  8.  
  9. @Configuration
  10. @EnableWebSocketMessageBroker
  11. public class WebSocketConfiguration implements WebSocketMessageBrokerConfigurer {
  12. /**
  13. *
  14. * @param config
  15. * Here we have enabled simple in memory message broker. We can register rabbit MQ also as message broker
  16. * by using the MessageBrokerRegistry config methods/
  17. */
  18. @Override
  19. public void configureMessageBroker(MessageBrokerRegistry config) {
  20. config.enableSimpleBroker("/chat-room");
  21. config.setApplicationDestinationPrefixes("/chat-app");
  22. }
  23.  
  24. @Override
  25. public void registerStompEndpoints(StompEndpointRegistry registry) {
  26. registry.addEndpoint("/sock").setAllowedOrigins("*").withSockJS();
  27. }
  28.  
  29.  
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement