@oox/socketio 1.0.0 → 1.0.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/adapter.js +8 -3
  2. package/package.json +1 -1
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.1",
4
4
  "description": "OOX SocketIO Module",
5
5
  "publishConfig": {
6
6
  "access": "public",