@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.
- package/adapter.js +8 -3
- package/package.json +1 -1
- 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
|
-
|
|
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
|
-
|
|
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
package/server.js
CHANGED