关于WebSOcket链接402错误

提问 未结 2 108
本家小许
本家小许 VIP4 2021-09-16 15:10:14
悬赏:20积分 收藏
产品:vue 版本:
基于JEEPlus的WebSocket配置,增加了自己的WebSocket的定义 public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { //注册 系统通知socket服务 registry.addHandler(systemInfoSocketHandler(),"/systemInfoSocketServer").addInterceptors(new SystemInfoSocketHandshakeInterceptor()); registry.addHandler(systemInfoSocketHandler(), "/sockjs/systemInfoSocketServer").addInterceptors(new SystemInfoSocketHandshakeInterceptor()) .withSockJS(); registry.addHandler(qrLoginSocketHandler(),"/qrLogin") .addInterceptors(new QRLoginHandshakeInterceptor()) .setAllowedOrigins("*"); } 客户端页面通过 var socketUrl="ws://192.168.68.179:8082/qrLogin/"+'login_123'; console.log(socketUrl); if(this.socket!=null){ this.socket.close(); this.socket=null; } this.socket = new WebSocket(socketUrl); //打开事件 this.socket.onopen = function() { console.log("websocket已打开"); //socket.send("这是来自客户端的消息" + location.href + new Date()); }; 链接报错 login.vue?8d26:269 WebSocket connection to 'ws://192.168.68.179:8082/qrLogin/login_123' failed: Error during WebSocket handshake: Unexpected response code: 402 单步调试没有走到QRLoginHandshakeInterceptor中去 请问什么原因
回帖