Uncaught DOMException: Failed to construct 'WebSocket': The URL 'xxx.xxx.com/' is invalid.
Uncaught DOMException: Failed to construct 'WebSocket': The URL 'xxx.xxx.com/' is invalid.
出现这个问题是构造 WebSocket失败了。
js代码改成
//实现化WebSocket对象,指定要连接的服务器地址与端口 建立连接
//等同于socket = new WebSocket(path+"/websocket/service8888");
socket = new WebSocket("xxx://192.168.5.7:8080/"+path+"/websocket/service8888");
在实际部署中需要放过对socket连接的拦截。