Uncaught DOMException: Failed to construct 'WebSocket': The URL '/qibao/websocket/service1000' is invalid.

出现这个问题是构造 WebSocket失败了。

js代码改成

//实现化WebSocket对象,指定要连接的服务器地址与端口  建立连接
//等同于socket = new WebSocket(path+"/websocket/service1000");
socket = new WebSocket("ws://192.168.5.7:8080/"+path+"/websocket/service1000");

在实际部署中需要放过对socket连接的拦截。
原文地址:https://www.cnblogs.com/zeussbook/p/9922396.html