olaylarındaki çağrı işlevleri bir olaydan sonra function demandConnexion işlevini çağırmaya çalışıyorum, ancak benim için çalışıyor, bana "this.demandeConnexion bir işlev değil" diyor. Bunu nasıl çalıştırabilirim? yardım, bu kod:NodeJs
Serveur.prototype.demandConnexion = function(idZEP) {
if (this.ZP.createZE(idZEP))
{
console.log(' ==> socket : demande de creation ZE pour '+idZEP +' accepte');
}
else
{
console.log(' ==> socket : demande de creation ZE pour '+idZEP +' refuse');
}
};
Serveur.prototype.traitementSurConnection = function(socket) {
// console.log('connexion');
console.log(' ==> socket connexion');
// traitement de l'evenement DEMANDE DE CONNEXION D'UNE ZE
socket.on('connection', (function(idZEP) { this.demandConnexion(idZEP)
console.log('good')
}))