Categories
JavaScript Answers

How to resolve Node Socket.io 404 (Not Found) error?

Spread the love

To resolve Node Socket.io 404 (Not Found) error, we connect to the URL and port of the Socket.io server.

For instance, we write

const app = express();
const server = app.listen(3000);
const io = require("socket.io").listen(server);

to call app.listen` to listen to port 3000.

Then we call listen with server to add socket.io to our app.

We can then connect to it at the URL with port 3000.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *