Answer the question
In order to leave comments, you need to log in
Where can I find examples of how Socket.io and Express work?
Hello, where can I see examples of
how
Socket.io and Express work for different
tasks
? kabinet.ejs", setSite)
}), from express
I can't put io.on connect into it, because the problem of "Accumulation of connections" appears.
If I take out io.on separately, then how to process functions inside io.on ?
Example:
io.on('connection', function(socket){
console.log('User connected');
sendUser(1,socket);
});
async function sendUser(s,socket){
var mm = await data.getUser(s)
socket.emit('sendToClient', { name: mm['name'], inrt: mm['rate'] });
}
In this example, there is a problem "TypeError: Cannot read property 'emit' of undefined"
In general, how they work together
I do not understand
Please help
Who is not lazy, here is the Darklarens#5695 discord
Thank you!
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question