0

About Spring websocket about intercept Stomp events one approach is extends from the ChannelInterceptorAdapter class

It works how is expected. More details here:

Now, according with this tutorial:

the approach mentioned above is covered and other approach is work around with ApplicationEvents, it through with:

These classes extends from:

And exists two subclasses more:

This list is confirmed in (by the same author):

The names are by themselves obvious to know what each one does, but just curious

  • Why there is no none for the send event?

It to react from:

stompClient.send('/app/ws/something', 
                 {}, 
                 JSON.stringify({'content': $('#content').val()})

For this send event "seems" mandatory work with the ChannelInterceptorAdapter through the postSend(Message<?> message, MessageChannel channel, boolean sent) method yet

Manuel Jordan
  • 15,253
  • 21
  • 95
  • 158

1 Answers1

2

The events reflect major points in the lifecycle of a STOMP connection. They're not meant to be notifications for every message sent from the client. For that you can use @MessageMapping methods, or a ChannelInterceptor.

Rossen Stoyanchev
  • 4,910
  • 23
  • 26
  • Rossen using the ChannelInterceptor with preSend method is the only way to intercept a send event? Is there any filter or something like this? – Guilherme Bernardi Dec 19 '19 at 17:41