Reputation: 1265
So, I've wrote a Web Dashboard for my public screenshot uploader. I've used socket.io combined with ejs to have dynamic content. I've also got an express backend serving the whole thing. Now that that's all cleared up, onto the issue.
After visiting 1 page with a socket.io connection then navigating to another (or the same location with a trailing slash) you receive a code: 0, transport error.
Edit: Currently using the latest version of socket.io, but older ones don't work either.
Extra Info:
Raw error: {"code":0,"message":"Transport unknown"}
Code: Very standard code, similar to what is used in the examples, initialized browserside using io({ path: "" })
, serverside using require("socket.io")(server, { path: "" })
, calls to the server using socket.emit
and socket.on
, nothing obvious that could possibly be throwing this error.
Other: No errors are emitted on the server, the client just receives that code as a response instead of any of the ejs that is supposed to be rendered. No errors are seen on the client console either.
Upvotes: 1
Views: 2534
Reputation: 707986
Remove the two path
properties from client and server initialization. Socket.io uses that to help it do its job. Those are not needed at all and may be causing your problem.
Upvotes: 1