ipc/server: differenciate 'close' and 'destroyed' events

This commit is contained in:
bordun 2020-04-05 18:23:09 +02:00
parent 27145901b4
commit ef74db5ce2
3 changed files with 7 additions and 2 deletions

View file

@ -29,6 +29,11 @@ module.exports = {
close(data, clientId) {
// client disconnected
},
destroyed(data, clientId) {
// client removed (timeout)
// clear osc data cache
if (widgetHashTable[clientId]) delete widgetHashTable[clientId]

View file

@ -67,7 +67,7 @@ class Socket extends EventEmitter {
this.dieTimeout = setTimeout(()=>{
this.emit('close')
this.emit('destroyed')
}, dieTimeout)

View file

@ -26,7 +26,7 @@ class Ipc extends EventEmitter {
this.emit('connection', client)
client.on('close', ()=>{
client.on('destroyed', ()=>{
delete this.clients[id]
})