@cuecue/socketio 0.0.39 → 0.0.40

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/dist/index.js +14 -6
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -22,6 +22,7 @@ class Base extends core.BasePlugin {
22
22
  super({
23
23
  host: process.env.SOCKETIO_HOST || 'localhost',
24
24
  namespace: process.env.SOCKETIO_NAMESPACE || null,
25
+ path: process.env.SOCKETIO_PATH || null,
25
26
  ...opts
26
27
  });
27
28
  this.onConnect = this.onConnect.bind(this);
@@ -42,9 +43,12 @@ class Base extends core.BasePlugin {
42
43
  async connectSocket() {
43
44
  const {
44
45
  host,
45
- namespace
46
+ namespace = null,
47
+ path = null
46
48
  } = this.options;
47
- this.socket = socket_ioClient.io(namespace !== null ? host.replace(/\/?$/, `/${namespace.replace(/^\//, '')}`) : host);
49
+ this.socket = socket_ioClient.io(namespace !== null ? host.replace(/\/?$/, `/${namespace.replace(/^\//, '')}`) : host, path !== null ? {
50
+ path
51
+ } : null);
48
52
  this.socket.on('connect', this.onConnect);
49
53
  return Promise.resolve();
50
54
  }
@@ -58,9 +62,10 @@ class Base extends core.BasePlugin {
58
62
  onConnect() {
59
63
  const {
60
64
  host,
61
- namespace
65
+ namespace = null,
66
+ path = null
62
67
  } = this.options;
63
- this.debug('Connected on %s/%s', host, namespace || '');
68
+ this.debug('Connected on %s/%s', host, namespace || '', path || '');
64
69
  }
65
70
 
66
71
  }
@@ -205,6 +210,7 @@ class BaseServer extends core.BasePlugin {
205
210
  namespace: process.env.SOCKETIO_NAMESPACE || null,
206
211
  transports: ['websocket', 'polling'],
207
212
  server: null,
213
+ path: '/socket.io/',
208
214
  ...opts
209
215
  });
210
216
  this.io = null;
@@ -230,11 +236,13 @@ class BaseServer extends core.BasePlugin {
230
236
  port,
231
237
  cors,
232
238
  transports,
233
- namespace
239
+ namespace,
240
+ path
234
241
  } = this.options;
235
242
  const ioOptions = {
236
243
  transports,
237
- cors
244
+ cors,
245
+ path
238
246
  };
239
247
  this.io = io__default["default"](ioOptions);
240
248
  this.namespace = namespace !== null ? this.io.of(namespace) : this.io;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuecue/socketio",
3
- "version": "0.0.39",
3
+ "version": "0.0.40",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@babel/runtime": "^7.12.5",
43
- "@cuecue/core": "^0.0.39",
43
+ "@cuecue/core": "^0.0.40",
44
44
  "debug": "^4.3.1",
45
45
  "lodash": "^4.17.21",
46
46
  "socket.io": "^4.1.2",
@@ -50,5 +50,5 @@
50
50
  "publishConfig": {
51
51
  "access": "public"
52
52
  },
53
- "gitHead": "283b8f467105917c14cab75611d34a95d4c2676f"
53
+ "gitHead": "82c3cb11882d14efb603064afa9bf8c4384df89f"
54
54
  }