@node-red/runtime 4.0.1 → 4.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,14 +23,16 @@ module.exports = {
23
23
  if (existingSessionId) {
24
24
  connections.delete(opts.session)
25
25
  const session = sessions.get(existingSessionId)
26
- session.active = false
27
- session.idleTimeout = setTimeout(() => {
28
- sessions.delete(existingSessionId)
29
- }, 30000)
30
- runtime.events.emit('comms', {
31
- topic: "multiplayer/connection-removed",
32
- data: { session: existingSessionId }
33
- })
26
+ if (session) {
27
+ session.active = false
28
+ session.idleTimeout = setTimeout(() => {
29
+ sessions.delete(existingSessionId)
30
+ }, 30000)
31
+ runtime.events.emit('comms', {
32
+ topic: "multiplayer/connection-removed",
33
+ data: { session: existingSessionId }
34
+ })
35
+ }
34
36
  }
35
37
  })
36
38
  runtime.events.on('comms:message:multiplayer/connect', (opts) => {
@@ -91,29 +93,32 @@ module.exports = {
91
93
  const sessionId = connections.get(opts.session)
92
94
  const session = sessions.get(sessionId)
93
95
 
94
- if (opts.user) {
95
- if (session.user.anonymous !== opts.user.anonymous) {
96
- session.user = opts.user
97
- runtime.events.emit('comms', {
98
- topic: 'multiplayer/connection-added',
99
- excludeSession: opts.session,
100
- data: session
101
- })
96
+ if (session) {
97
+ if (opts.user) {
98
+ if (session.user.anonymous !== opts.user.anonymous) {
99
+ session.user = opts.user
100
+ runtime.events.emit('comms', {
101
+ topic: 'multiplayer/connection-added',
102
+ excludeSession: opts.session,
103
+ data: session
104
+ })
105
+ }
102
106
  }
103
- }
104
107
 
105
- session.location = opts.data
108
+ session.location = opts.data
106
109
 
107
- const payload = {
108
- session: sessionId,
109
- workspace: opts.data.workspace,
110
- node: opts.data.node
110
+ const payload = {
111
+ session: sessionId,
112
+ workspace: opts.data.workspace,
113
+ node: opts.data.node,
114
+ cursor: opts.data.cursor
115
+ }
116
+ runtime.events.emit('comms', {
117
+ topic: 'multiplayer/location',
118
+ data: payload,
119
+ excludeSession: opts.session
120
+ })
111
121
  }
112
- runtime.events.emit('comms', {
113
- topic: 'multiplayer/location',
114
- data: payload,
115
- excludeSession: opts.session
116
- })
117
122
  })
118
123
  }
119
124
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-red/runtime",
3
- "version": "4.0.1",
3
+ "version": "4.0.3",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./lib/index.js",
6
6
  "repository": {
@@ -16,11 +16,11 @@
16
16
  }
17
17
  ],
18
18
  "dependencies": {
19
- "@node-red/registry": "4.0.1",
20
- "@node-red/util": "4.0.1",
19
+ "@node-red/registry": "4.0.3",
20
+ "@node-red/util": "4.0.3",
21
21
  "async-mutex": "0.5.0",
22
22
  "clone": "2.1.2",
23
- "express": "4.19.2",
23
+ "express": "4.21.0",
24
24
  "fs-extra": "11.2.0",
25
25
  "json-stringify-safe": "5.0.1",
26
26
  "rfdc": "^1.3.1"