@folklore/socket 0.4.28 → 0.4.30

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/dist/cjs.js CHANGED
@@ -21,6 +21,7 @@ class PubNubSocket extends EventEmitter {
21
21
  publishKey: null,
22
22
  subscribeKey: null,
23
23
  secretKey: null,
24
+ userId: null,
24
25
  withPresence: false,
25
26
  ...opts
26
27
  };
@@ -102,11 +103,15 @@ class PubNubSocket extends EventEmitter {
102
103
  } = this;
103
104
  const pubnubOptions = {
104
105
  publishKey: this.options.publishKey,
105
- subscribeKey: this.options.subscribeKey
106
+ subscribeKey: this.options.subscribeKey,
107
+ userId: `web-user-${Math.floor(Math.random() * 1000)}`
106
108
  };
107
109
  if (this.options.uuid !== null) {
108
110
  pubnubOptions.uuid = this.options.uuid;
109
111
  }
112
+ if (this.options.userId !== null) {
113
+ pubnubOptions.userId = this.options.userId;
114
+ }
110
115
  if (this.options.secretKey !== null) {
111
116
  pubnubOptions.secretKey = this.options.secretKey;
112
117
  }
package/dist/es.js CHANGED
@@ -17,6 +17,7 @@ class PubNubSocket extends EventEmitter {
17
17
  publishKey: null,
18
18
  subscribeKey: null,
19
19
  secretKey: null,
20
+ userId: null,
20
21
  withPresence: false,
21
22
  ...opts
22
23
  };
@@ -98,11 +99,15 @@ class PubNubSocket extends EventEmitter {
98
99
  } = this;
99
100
  const pubnubOptions = {
100
101
  publishKey: this.options.publishKey,
101
- subscribeKey: this.options.subscribeKey
102
+ subscribeKey: this.options.subscribeKey,
103
+ userId: `web-user-${Math.floor(Math.random() * 1000)}`
102
104
  };
103
105
  if (this.options.uuid !== null) {
104
106
  pubnubOptions.uuid = this.options.uuid;
105
107
  }
108
+ if (this.options.userId !== null) {
109
+ pubnubOptions.userId = this.options.userId;
110
+ }
106
111
  if (this.options.secretKey !== null) {
107
112
  pubnubOptions.secretKey = this.options.secretKey;
108
113
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@folklore/socket",
3
- "version": "0.4.28",
3
+ "version": "0.4.30",
4
4
  "description": "Socket utilities",
5
5
  "keywords": [
6
6
  "javascript",
@@ -56,5 +56,5 @@
56
56
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
57
57
  "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
58
58
  },
59
- "gitHead": "729e543ff89bac05964cdafb710eeb79d8e09362"
59
+ "gitHead": "ac2a28eb9ac66baf8b2203307806e752719e771c"
60
60
  }