mirror of https://github.com/node-red/node-red.git
Guard against undefined sessions in multiplayer
parent
1b5b3f7f88
commit
011b47a108
|
@ -23,14 +23,16 @@ module.exports = {
|
||||||
if (existingSessionId) {
|
if (existingSessionId) {
|
||||||
connections.delete(opts.session)
|
connections.delete(opts.session)
|
||||||
const session = sessions.get(existingSessionId)
|
const session = sessions.get(existingSessionId)
|
||||||
session.active = false
|
if (session) {
|
||||||
session.idleTimeout = setTimeout(() => {
|
session.active = false
|
||||||
sessions.delete(existingSessionId)
|
session.idleTimeout = setTimeout(() => {
|
||||||
}, 30000)
|
sessions.delete(existingSessionId)
|
||||||
runtime.events.emit('comms', {
|
}, 30000)
|
||||||
topic: "multiplayer/connection-removed",
|
runtime.events.emit('comms', {
|
||||||
data: { session: existingSessionId }
|
topic: "multiplayer/connection-removed",
|
||||||
})
|
data: { session: existingSessionId }
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
runtime.events.on('comms:message:multiplayer/connect', (opts) => {
|
runtime.events.on('comms:message:multiplayer/connect', (opts) => {
|
||||||
|
|
Loading…
Reference in New Issue