2

I was trying the tutorial provided by spring - messaging-stomp-websocket and it is working fine

Now I want to extend the this and add my WebSocket handler which intercept the channel.

public class WebSocketHandlerSpring extends TextWebSocketHandler { @Override public void handleTextMessage(WebSocketSession session, TextMessage message) { } } 

This handler to WebSocketConfig class.

@Configuration @EnableWebSocketMessageBroker public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer { @Override public void configureMessageBroker(MessageBrokerRegistry config) { config.enableSimpleBroker("/topic"); config.setApplicationDestinationPrefixes("/app"); } @Override public void registerStompEndpoints(StompEndpointRegistry registry) { registry.addEndpoint("/hello").withSockJS(); } } 

Any help how to configure WebSocketHandlerSpring handler to WebSocketConfig ?

1 Answer 1

2

Raw WebSocketHandler support comes from @EnableWebSocket (not @EnableWebSocketMessageBroker). You need to add that and implement WebSocketConfigurer to register your endpoints. Example here.

Sign up to request clarification or add additional context in comments.

2 Comments

thnaks and impressive
The page does not exist, can you update ur answer?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.