**
WebSocket connection to ‘ws://127.0.0.1:8080/stomp/ws/1’ failed: Error during WebSocket handshake:Unexpected response code: 200
**
最近研究websocket的时候遇到了这个问题,前端vue 连接 的时候一直连接不上,找了下原因是Security拦截了 解决办法就是在SecurityConfig里面添加代码
.antMatchers("/websocket/**").anonymous()
这里的/websocket 是根据你自己设置地址,并不是确定的一成不变的。详情如下图所示: