• Websocket拦截器HandshakeInterceptor


    https://www.jianshu.com/p/7c98820f0364

    org.springframework.web.socket.server

    Interface HandshakeInterceptor

    所有已知实现类

    HttpSessionHandshakeInterceptor


    public interface HandshakeInterceptor
    WebSocket握手请求的拦截器. 检查握手请求和响应, 对WebSocketHandler传递属性


    • boolean beforeHandShake(ServerHttpRequest request,ServerHttpResponse response, WebSocketHandler wsHandler, Map<String, Object> attributes) throws Exception
      在握手之前执行该方法, 继续握手返回true, 中断握手返回false. 通过attributes参数设置WebSocketSession的属性
    • void afterHandshake(ServerHttpRequest request,ServerHttpResponse response, WebSocketHandler wsHandler, Map<String, Object> attributes) throws Exception
      在握手之后执行该方法. 无论是否握手成功都指明了响应状态码和相应头.


    作者:写java的逗比叫z1
    链接:https://www.jianshu.com/p/7c98820f0364
    來源:简书
    简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。
  • 相关阅读:
    jquery-scrollstop
    Grunt usemin
    HTML5 之文件操作(file)
    启动mongodb bat
    判断是否支持WebP
    前端攻略系列(一)
    impress.js初体验
    JS应用实例3:定时弹出广告
    JS应用实例2:轮播图
    JS应用实例1:注册页面表单校验
  • 原文地址:https://www.cnblogs.com/handsome1013/p/9389127.html
Copyright © 2020-2023  润新知