console.log(); doesn't work in the socket.io connections.
For some reason, the console.log() function does not work in the socket.io part of the program:
io.on('connection', (socket) => {
console.log('User connected');
socket.on('disconnect', () => {
console.log('User disconnected');
});
});
All help appreciated!
You aren't connecting from the client side. You need to serve an html file that includes the socket.io client library.
Check out this link for more info: https://socket.io/get-started/chat/
Hope this helps!
@oluwamayowa : Okay, thanks!
@vedprad1 No prob, if you need any more help ask away!
@oluwamayowa : Actually, it turns out that it still isn't working. I don't know why, though.
@vedprad1 You forgot to include the socket.io.js file in you directory. You can either download the library or use the CDN (https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js)