@cuecue/socketio 0.0.32 → 0.0.35
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/index.js +14 -14
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -201,16 +201,17 @@ class BaseServer extends core.BasePlugin {
|
|
|
201
201
|
...opts
|
|
202
202
|
} = {}) {
|
|
203
203
|
super({
|
|
204
|
-
port: process.env.SOCKETIO_PORT ||
|
|
204
|
+
port: process.env.SOCKETIO_PORT || 5000,
|
|
205
205
|
namespace: process.env.SOCKETIO_NAMESPACE || null,
|
|
206
|
+
transports: ['websocket', 'polling'],
|
|
206
207
|
server: null,
|
|
207
208
|
...opts
|
|
208
209
|
});
|
|
209
210
|
this.io = null;
|
|
210
|
-
this.namespace
|
|
211
|
+
this.namespace = null;
|
|
211
212
|
this.onConnection = this.onConnection.bind(this);
|
|
212
213
|
this.commands = commands;
|
|
213
|
-
this.debug = createDebug__default["default"]('cuecue:socketio');
|
|
214
|
+
this.debug = createDebug__default["default"]('cuecue:socketio-server');
|
|
214
215
|
}
|
|
215
216
|
|
|
216
217
|
async onInit() {
|
|
@@ -228,9 +229,11 @@ class BaseServer extends core.BasePlugin {
|
|
|
228
229
|
server,
|
|
229
230
|
port,
|
|
230
231
|
cors,
|
|
232
|
+
transports,
|
|
231
233
|
namespace
|
|
232
234
|
} = this.options;
|
|
233
235
|
const ioOptions = {
|
|
236
|
+
transports,
|
|
234
237
|
cors
|
|
235
238
|
};
|
|
236
239
|
this.io = io__default["default"](ioOptions);
|
|
@@ -262,12 +265,16 @@ class ServerInput extends BaseServer {
|
|
|
262
265
|
} = {}) {
|
|
263
266
|
super({
|
|
264
267
|
namespace: process.env.SOCKETIO_INPUT_NAMESPACE || null,
|
|
268
|
+
cors: {
|
|
269
|
+
origin: 'http://localhost:5000'
|
|
270
|
+
},
|
|
265
271
|
...opts
|
|
266
272
|
});
|
|
267
|
-
this.
|
|
273
|
+
this.onConnection = this.onConnection.bind(this);
|
|
268
274
|
this.onMessage = this.onMessage.bind(this);
|
|
269
275
|
this.commands = commands;
|
|
270
276
|
this.debug = createDebug__default["default"]('cuecue:input:socketio-server');
|
|
277
|
+
this.debug('started on: %O %s', opts, process.env.SOCKETIO_INPUT_NAMESPACE);
|
|
271
278
|
}
|
|
272
279
|
|
|
273
280
|
setInputCommands(commands) {
|
|
@@ -311,7 +318,8 @@ class ServerOutput extends BaseServer {
|
|
|
311
318
|
...opts
|
|
312
319
|
});
|
|
313
320
|
this.socket = null;
|
|
314
|
-
this.debug = createDebug__default["default"]('cuecue:output:socketio');
|
|
321
|
+
this.debug = createDebug__default["default"]('cuecue:output:socketio-server');
|
|
322
|
+
this.debug('started on: %O %s', opts, process.env.SOCKETIO_OUTPUT_NAMESPACE);
|
|
315
323
|
}
|
|
316
324
|
|
|
317
325
|
cue(cue, extraData = null) {
|
|
@@ -376,21 +384,13 @@ class ServerOutput extends BaseServer {
|
|
|
376
384
|
|
|
377
385
|
async send(...args) {
|
|
378
386
|
this.debug('send: %o', args);
|
|
379
|
-
const {
|
|
380
|
-
namespace = null
|
|
381
|
-
} = this.options;
|
|
382
|
-
|
|
383
|
-
if (namespace !== null) {
|
|
384
|
-
return this.sendToNamespace(namespace, ...args);
|
|
385
|
-
}
|
|
386
|
-
|
|
387
387
|
this.namespace.send(...args);
|
|
388
388
|
return Promise.resolve();
|
|
389
389
|
}
|
|
390
390
|
|
|
391
391
|
async sendToNamespace(namespace, ...args) {
|
|
392
392
|
this.debug('send: %o', args);
|
|
393
|
-
this.
|
|
393
|
+
this.io.of(namespace).send(...args);
|
|
394
394
|
return Promise.resolve();
|
|
395
395
|
}
|
|
396
396
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cuecue/socketio",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.35",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@babel/runtime": "^7.12.5",
|
|
43
|
-
"@cuecue/core": "^0.0.
|
|
43
|
+
"@cuecue/core": "^0.0.35",
|
|
44
44
|
"debug": "^4.3.1",
|
|
45
|
-
"lodash": "^4.17.
|
|
45
|
+
"lodash": "^4.17.21",
|
|
46
46
|
"socket.io": "^4.1.2",
|
|
47
47
|
"socket.io-client": "^4.1.2",
|
|
48
48
|
"uuid": "^8.3.2"
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "d7490c5fd8b8720dbab8344baaa50a6ee18e90df"
|
|
54
54
|
}
|