Search code examples
springspring-websocket

Spring websocket Override DefaultUserDestinationResolver


I want to override DefaultUserDestinationResolver so i can implement my custom queue user destination for example

/user/queue/call currently it is changed into /queue/call-user{session-id} , while in my case i want it to be changed into /queue/call-{userid}

The reason for this is that i want to be able to send a message to a user that is not subscribed yet and when he subscribe he can receive the message .

How can i ask spring to use my implementation of UserDestinationResolver


Solution

  • Try to implement WebSocketMessageBrokerConfigurationSupport for some of your @Configuration and override:

    @Bean
    public UserDestinationResolver userDestinationResolver() { 
    ...
    }
    

    for your purpose.