Anton Sorokin
Anton Sorokin

Reputation: 544

How to get destination from disconnect message?

I have a WebSocket app on Spring Boot. I use STOMP, and I need to get destination path when user close the tab(disconnect from WS). I intercept the disconnect either with @EventListener or extends from ChannelInterceptor and override preSend().

I tried many ways - StompHeaderAccessor.getDestination(), SessionDisconnectEvent.getMessage().getHeaders().get("simpDestination"), etc, but they all return null. Is there a working way to get the path? Maybe not using interceptors, somehow differently?

Upvotes: 0

Views: 632

Answers (1)

Justin Bertram
Justin Bertram

Reputation: 35093

I can't speak to Spring specifics, but I don't think the information you want is available from a Stomp perspective. As noted in the Stomp 1.2 specification, the DISCONNECT frame doesn't use any kind of destination header. The only possible header is receipt. The semantics of receipts are explained here.

Upvotes: 1

Related Questions