@jcbuisson/express-x-client 3.1.0 → 3.1.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/client.mts +8 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jcbuisson/express-x-client",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "type": "module",
5
5
  "description": "Client library for ExpressX framework",
6
6
  "main": "src/client.mts",
package/src/client.mts CHANGED
@@ -153,19 +153,17 @@ export async function reloadPlugin(app) {
153
153
  const prevSocketId = cnxid.value
154
154
  if (prevSocketId) {
155
155
  console.log('cnx-transfer', prevSocketId, 'to', socketId)
156
- await socket.emit('cnx-transfer', prevSocketId, socketId)
157
- cnxid.value = socketId
156
+ socket.once('cnx-transfer-ack', async (fromSocketId, toSocketId) => {
157
+ console.log('ACK ACK!!!', fromSocketId, toSocketId)
158
+ cnxid.value = socketId
159
+ })
160
+ socket.once('cnx-transfer-error', async (fromSocketId, toSocketId) => {
161
+ console.log('ERR ERR!!!', fromSocketId, toSocketId)
162
+ })
163
+ socket.emit('cnx-transfer', prevSocketId, socketId)
158
164
  } else {
159
165
  cnxid.value = socketId
160
166
  }
161
-
162
- socket.on('cnx-transfer-ack', async (fromSocketId, toSocketId) => {
163
- console.log('ACK ACK!!!', fromSocketId, toSocketId)
164
- })
165
-
166
- socket.on('cnx-transfer-error', async (fromSocketId, toSocketId) => {
167
- console.log('ERR ERR!!!', fromSocketId, toSocketId)
168
- })
169
167
  })
170
168
  }
171
169