@oox/socketio 1.0.0 → 1.0.2

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 (3) hide show
  1. package/adapter.js +8 -3
  2. package/package.json +1 -1
  3. package/server.js +1 -0
package/adapter.js CHANGED
@@ -12,7 +12,7 @@ export default class SocketIOAdapter extends SampleKeepAliveConnectionAdapter {
12
12
  'x-caller': name,
13
13
  'x-caller-id': id,
14
14
  };
15
- let mURL;
15
+ let mURL = undefined;
16
16
  const connectionData = {
17
17
  name: 'anonymous',
18
18
  id: randomUUID(),
@@ -29,12 +29,17 @@ export default class SocketIOAdapter extends SampleKeepAliveConnectionAdapter {
29
29
  else if (identify.url) {
30
30
  // KeepAliveConnectionData
31
31
  Object.assign(connectionData, identify);
32
- mURL = new URL(identify.url);
32
+ if ('string' === typeof identify.url) {
33
+ mURL = genWebSocketURL(identify.url);
34
+ }
35
+ else if (identify.url instanceof URL) {
36
+ mURL = identify.url;
37
+ }
33
38
  if (identify.token) {
34
39
  headers['x-token'] = identify.token;
35
40
  }
36
41
  }
37
- else {
42
+ if (!mURL) {
38
43
  throw new Error('identify must be string, URL, or KeepAliveConnectionData');
39
44
  }
40
45
  const socket = SocketIOClient.io(mURL.origin, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oox/socketio",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "OOX SocketIO Module",
5
5
  "publishConfig": {
6
6
  "access": "public",
package/server.js CHANGED
@@ -179,6 +179,7 @@ export default class SocketIOServer extends Module {
179
179
  token,
180
180
  });
181
181
  oox.addKeepAliveConnection(connection);
182
+ connection.emit('connect');
182
183
  this.bindServerConnectionEvents(connection);
183
184
  socket.emit(OOXEvent.READY, {
184
185
  id: oox.config.id,