WebSocketConfig.kt 866 B

1234567891011121314151617181920212223
  1. package co.id.datacomsolusindo.ipphonebridge
  2. import org.springframework.context.annotation.Configuration
  3. import org.springframework.messaging.simp.config.MessageBrokerRegistry
  4. import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker
  5. import org.springframework.web.socket.config.annotation.StompEndpointRegistry
  6. import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer
  7. @Configuration
  8. @EnableWebSocketMessageBroker
  9. class WebSocketConfig : WebSocketMessageBrokerConfigurer {
  10. override fun configureMessageBroker(config: MessageBrokerRegistry) {
  11. config.enableSimpleBroker("/topic")
  12. config.setApplicationDestinationPrefixes("/app")
  13. }
  14. override fun registerStompEndpoints(registry: StompEndpointRegistry) {
  15. registry.addEndpoint("/websocket").setAllowedOrigins("*")
  16. }
  17. }