Spring websocket:如何通过 AbstractSubProtocolEvent 层级拦截发送事件?
Spring websocket: how intercept the send event through the AbstractSubProtocolEvent hierarchy?
关于Spring websocket 关于拦截Stomp
事件的一种方法是从ChannelInterceptorAdapter扩展class
它按预期工作。此处有更多详细信息:
现在,按照这个教程:
上面提到的方法已涵盖 和 其他方法是使用 ApplicationEvents
解决,它通过:
这些 classes 扩展自:
还有两个子class:
此列表已在(由同一作者)确认:
- how to capture connection event in my webSocket server with Spring 4?
这些名字本身就很明显知道每个人的作用,但只是好奇
- 为什么
send
事件没有 none?
它的反应来自:
stompClient.send('/app/ws/something',
{},
JSON.stringify({'content': $('#content').val()})
对于此 send
事件 "seems" 必须通过 postSend(Message<?> message, MessageChannel channel, boolean sent)
方法与 ChannelInterceptorAdapter
合作
这些事件反映了 STOMP 连接生命周期中的主要 点。它们并不意味着是从客户端发送的每条消息的通知。为此,您可以使用 @MessageMapping
方法,或 ChannelInterceptor
.
关于Spring websocket 关于拦截Stomp
事件的一种方法是从ChannelInterceptorAdapter扩展class
它按预期工作。此处有更多详细信息:
现在,按照这个教程:
上面提到的方法已涵盖 和 其他方法是使用 ApplicationEvents
解决,它通过:
这些 classes 扩展自:
还有两个子class:
此列表已在(由同一作者)确认:
- how to capture connection event in my webSocket server with Spring 4?
这些名字本身就很明显知道每个人的作用,但只是好奇
- 为什么
send
事件没有 none?
它的反应来自:
stompClient.send('/app/ws/something',
{},
JSON.stringify({'content': $('#content').val()})
对于此 send
事件 "seems" 必须通过 postSend(Message<?> message, MessageChannel channel, boolean sent)
方法与 ChannelInterceptorAdapter
合作
这些事件反映了 STOMP 连接生命周期中的主要 点。它们并不意味着是从客户端发送的每条消息的通知。为此,您可以使用 @MessageMapping
方法,或 ChannelInterceptor
.