Answer the question
In order to leave comments, you need to log in
How to query db from websocket server on node.js?
How to execute a db query when client disconnects from websocket in node.js ?
Disconnect Event:
socket.on('disconnect', () => {
clients.splice(clients.indexOf(socket.id), 1);
socket.emit({"discconnected":userId,"roomOut":room});
console.log({"discconnected":userId,"roomOut":room});
})
});
session_start();
require_once('../system/Config.php');
if($_POST['GetOutRoom']) {
$id=$_POST['GetOutRoom'];
$updata1 = "UPDATE `user` SET `ontime`=0 WHERE `uid` = $id";
$up1 = $pdo->prepare("$updata1");
$up1->execute();
}
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