Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
前端client 连接 socket.io 报错,Invalid namespace。
const socket = io(`http://127.0.0.1:8080/h5`);
h5 是命令空间,这么写没错吧?
h5
后端使用是Java,使用 netty-socket.io 搭建。
... server = new SocketIOServer(buildConfig()); server.addNamespace("h5"); ...
namespace 需要加反斜杠 “/”。 所以改成 server.addNamespace("/h5");
server.addNamespace("/h5");
感谢大佬