我使用
spring 4,STOMP和sock.js进行了简单的Web套接字通信,遵循此
https://github.com/rstoyanchev/spring-websocket-portfolio和此
http://assets.spring.io/wp/WebSocketBlogPost.html
好吧,我想知道是否有可能捕获连接事件,例如当新客户端连接到我的服务器或客户端断开连接时,是否可以在Spring 4.0.0中进行?
这可以通过连接握手拦截器( HttpSessionHandshakeInterceptor)完成,引用 documentation:The easiest way to customize the initial HTTP WebSocket handshake request is through a HandshakeInterceptor, which exposes “before” and “after” the handshake methods.
精彩评论