Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

166
Views
servidor DisconnectUser si el usuario abre otro programa en andorid

Tengo un script de chat y funciona bien, pero si el miembro entra por Android y sale del chat y abre cualquier otro programa, el servidor lo eliminará. Este es mi servidor js commond.

 //DisconnectUser io.use((socket, next) => { next(); }).on('connection', socket => { console.log('(default) client connected'); }); socket.on("disconnect", function () { var userData = UserInfo[socket.id]; if (typeof userData !== "undefined") { if (UserInfo[socket.id].powers["stealth"] == 1000 && UserInfo[socket.id].stealth == true) { } else { io.to(userData.idroom).emit("msg", { cmd: "msg", data: { bg: "none", class: "hmsg", topic: userData.username, msg: "( هذا المستخدم غادر الدردشة)", roomid: userData.idroom, pic: userData.pic, }, }); } if (UserInfo[socket.id].uid) { var UpdateUser = { $set: { lastssen: new Date().getTime(), token: stringGen(177), }, }; user_list.updateOne({ id: UserInfo[socket.id].uid }, UpdateUser, function (err, uruser) { if (err) throw err; if (uruser) { } }); } io.emit("msg", { cmd: "ur", data: [userData.id, null] }); socket.leave(userData.idroom); } delete UserInfo[socket.id]; const indexw = online.findIndex((x) => x.id == socket.id); if (indexw != -1) { online.splice( online.findIndex((v) => v.id == socket.id), 1 ); io.emit("msg", { cmd: "u-", data: socket.id }); } var index = UserEntre.findIndex((x) => x == socket.id); if (index != -1) { UserEntre.splice(UserEntre.indexOf(socket.id), 1); } lastssen: new Date().getTime(); });

**¿Qué hago para mantener al usuario en el chat por más tiempo? **

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!