You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I have started making a simple webpage and I plan on using socket.io for simple communication between the client and server. Right now all that I have is a simple server and client that logs when someone connects or disconnects from any client, so this means I have: io.on('connection', (socket) => { io.emit("join", socket.id)
on my server and: socket.on("join", (id) => { console.log(user ${id} added);
on my client. The line io.emit("join", socket.id) is making the console on both the server and client fill up with connection messages, each with their own ID, just from one client being connected once. There is no other javascript on my client that would make it refresh or reconnect for any reason.
Thank you for the information, I am stuck on this and my professional programmer friend couldn't figure it out either :).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I have started making a simple webpage and I plan on using socket.io for simple communication between the client and server. Right now all that I have is a simple server and client that logs when someone connects or disconnects from any client, so this means I have:
io.on('connection', (socket) => { io.emit("join", socket.id)
on my server and:
socket.on("join", (id) => { console.log(
user ${id} added);
on my client. The line
io.emit("join", socket.id)
is making the console on both the server and client fill up with connection messages, each with their own ID, just from one client being connected once. There is no other javascript on my client that would make it refresh or reconnect for any reason.Thank you for the information, I am stuck on this and my professional programmer friend couldn't figure it out either :).
Beta Was this translation helpful? Give feedback.
All reactions