Socket.io Tutorial "Chat" is broken
See original GitHub issue- report a bug
- request a feature
Current behaviour
Following the current tutorial version on the socket.io documentation to build a small chat system doesn’t work at all.
Steps to reproduce (if the current behaviour is a bug)
The steps beginning with setting up a basic express server are fine, also adding socket.io to that http server and the connection-event is fine.
When it comes to adding the html snippet for the socket.io-client and establishing the connection, it breaks. First of all, the file is not accessible on the express server, so I replaced it with the cdn version. Now it tries to connect, but fails again, probably because it’s trying to reach the socket on a different path (socket.io-1.2.0.js:2 GET http://localhost:3000/socket.io/?EIO=3&transport=polling&t=1483818339831-18 404 (Not Found)), the tutorial states that the socket is available on /
.
Debugging the sockets with 2 different chrome extensions also doesn’t work, they are also not able to establish connections to both of these paths.
Expected behaviour
Tutorials should contain a working example, to allow beginners (like me) to quickly gain experience.
Setup
- OS: Windows 10
- browser: Chrome
- socket.io version: current/latest
Other information (e.g. stacktraces, related issues, suggestions how to fix)
Rewriting the tutorial from scratch should help here.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
@max06 I think the issue lies in the
app.listen(3000);
. According to the reference:Also, you should be able to replace
<script src="https://cdn.socket.io/socket.io-1.4.5.js"></script>
with<script src="/socket.io/socket.io.js"></script>
.You’re welcome!