背景
前端websocket使用wss协议代码如下
this.websock = new WebSocket(`ws://xxxx:9092/blog/websocket/${this.currentUser.id}`)
nginx配置
后台配置
@ServerEndpoint(value = "/websocket/{userId}")
@Component
public class BlogSocket {
问题描述
经过上面配置,浏览器报错 failed: Error during WebSocket handshake: Unexpected response code: 404
猜测
不知道后台那么配置能不能接受到nginx转发的http协议,可能问题出现在这。
请指点一下,万分感谢