@cuecue/socketio 0.0.23 → 0.0.27
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 +409 -0
- package/package.json +8 -6
- package/lib/index.js +0 -572
package/dist/index.js
ADDED
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
import createDebug from 'debug';
|
|
2
|
+
import isArray from 'lodash/isArray';
|
|
3
|
+
import { BasePlugin } from '@cuecue/core';
|
|
4
|
+
import { io } from 'socket.io-client';
|
|
5
|
+
import io$1 from 'socket.io';
|
|
6
|
+
|
|
7
|
+
class Base extends BasePlugin {
|
|
8
|
+
constructor({
|
|
9
|
+
commands = null,
|
|
10
|
+
...opts
|
|
11
|
+
} = {}) {
|
|
12
|
+
super({
|
|
13
|
+
host: process.env.SOCKETIO_HOST || 'localhost',
|
|
14
|
+
namespace: process.env.SOCKETIO_NAMESPACE || null,
|
|
15
|
+
...opts
|
|
16
|
+
});
|
|
17
|
+
this.onConnect = this.onConnect.bind(this);
|
|
18
|
+
this.commands = commands;
|
|
19
|
+
this.debug = createDebug('cuecue:socketio');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async onInit() {
|
|
23
|
+
await super.onInit();
|
|
24
|
+
await this.connectSocket();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async onDestroy() {
|
|
28
|
+
await this.closeSocket();
|
|
29
|
+
await super.onDestroy();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async connectSocket() {
|
|
33
|
+
const {
|
|
34
|
+
host,
|
|
35
|
+
namespace
|
|
36
|
+
} = this.options;
|
|
37
|
+
this.socket = io(namespace !== null ? host.replace(/\/?$/, `/${namespace.replace(/^\//, '')}`) : host);
|
|
38
|
+
this.socket.on('connect', this.onConnect);
|
|
39
|
+
return Promise.resolve();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async closeSocket() {
|
|
43
|
+
this.socket.off('connect', this.onConnect);
|
|
44
|
+
this.socket.close();
|
|
45
|
+
return Promise.resolve();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
onConnect() {
|
|
49
|
+
const {
|
|
50
|
+
host,
|
|
51
|
+
namespace
|
|
52
|
+
} = this.options;
|
|
53
|
+
this.debug('Connected on %s/%s', host, namespace || '');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
class ClientInput extends Base {
|
|
59
|
+
constructor({
|
|
60
|
+
commands = null,
|
|
61
|
+
...opts
|
|
62
|
+
} = {}) {
|
|
63
|
+
super({
|
|
64
|
+
namespace: process.env.SOCKETIO_INPUT_NAMESPACE || null,
|
|
65
|
+
...opts
|
|
66
|
+
});
|
|
67
|
+
this.onMessage = this.onMessage.bind(this);
|
|
68
|
+
this.commands = commands;
|
|
69
|
+
this.debug = createDebug('cuecue:input:socketio');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
setInputCommands(commands) {
|
|
73
|
+
this.commands = commands;
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async onInit() {
|
|
78
|
+
await super.onInit();
|
|
79
|
+
this.socket.on('message', this.onMessage);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async onDestroy() {
|
|
83
|
+
this.socket.off('message', this.onMessage);
|
|
84
|
+
await super.onDestroy();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async onMessage(message) {
|
|
88
|
+
const {
|
|
89
|
+
transformMessage = null,
|
|
90
|
+
transformCommand = null
|
|
91
|
+
} = this.options;
|
|
92
|
+
const {
|
|
93
|
+
command = null,
|
|
94
|
+
args = []
|
|
95
|
+
} = (transformMessage !== null ? await transformMessage(message) : message) || {};
|
|
96
|
+
const {
|
|
97
|
+
command: finalCommand = command,
|
|
98
|
+
args: finalArgs = args
|
|
99
|
+
} = (transformCommand !== null ? await transformCommand(command, args) : null) || {};
|
|
100
|
+
|
|
101
|
+
if (this.commands === null || this.commands.indexOf(finalCommand) !== -1) {
|
|
102
|
+
this.debug('command: %s args: %o', finalCommand, finalArgs);
|
|
103
|
+
this.emit('command', command, ...(isArray(finalArgs) ? finalArgs : [finalArgs]));
|
|
104
|
+
} else {
|
|
105
|
+
this.debug('message: %o', message);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
class ClientOutput extends Base {
|
|
112
|
+
constructor(opts = {}) {
|
|
113
|
+
super({
|
|
114
|
+
namespace: process.env.SOCKETIO_OUTPUT_NAMESPACE || null,
|
|
115
|
+
...opts
|
|
116
|
+
});
|
|
117
|
+
this.socket = null;
|
|
118
|
+
this.debug = createDebug('cuecue:output:socketio');
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
cue(cue, extraData = null) {
|
|
122
|
+
this.command('cue', cue, extraData);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
cues(cues) {
|
|
126
|
+
this.command('cues', cues);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
interact(data, interactionId = null) {
|
|
130
|
+
this.command('interact', data, interactionId);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
interaction(interaction) {
|
|
134
|
+
this.command('interaction', interaction);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
uninteraction(interactionId) {
|
|
138
|
+
this.command('uninteract', interactionId);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
uninteractions(interactionIds) {
|
|
142
|
+
this.command('uninteractions', interactionIds);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
async command(command, ...args) {
|
|
146
|
+
const {
|
|
147
|
+
transformCommand = null,
|
|
148
|
+
transformMessage = null,
|
|
149
|
+
acceptCommand = null
|
|
150
|
+
} = this.options;
|
|
151
|
+
const value = transformCommand !== null ? await transformCommand(command, args) : {
|
|
152
|
+
command,
|
|
153
|
+
args
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
if (value === false) {
|
|
157
|
+
this.debug('command canceled: %s %o', command, args);
|
|
158
|
+
return Promise.resolve();
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const {
|
|
162
|
+
command: finalCommand = command,
|
|
163
|
+
args: finalArgs = args
|
|
164
|
+
} = value || {};
|
|
165
|
+
|
|
166
|
+
if (acceptCommand !== null && !acceptCommand(finalCommand, finalArgs)) {
|
|
167
|
+
this.debug('command refused: %s %o', finalCommand, finalArgs);
|
|
168
|
+
return Promise.resolve();
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
this.debug('command: %s message: %o', finalCommand, finalArgs);
|
|
172
|
+
const message = {
|
|
173
|
+
command: finalCommand,
|
|
174
|
+
args: finalArgs
|
|
175
|
+
};
|
|
176
|
+
const payload = transformMessage !== null ? await transformMessage(message) : message;
|
|
177
|
+
return this.send(payload);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
async send(...args) {
|
|
181
|
+
this.debug('send: %o', args);
|
|
182
|
+
this.socket.send(...args);
|
|
183
|
+
return Promise.resolve();
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
class BaseServer extends BasePlugin {
|
|
189
|
+
constructor({
|
|
190
|
+
commands = null,
|
|
191
|
+
...opts
|
|
192
|
+
} = {}) {
|
|
193
|
+
super({
|
|
194
|
+
port: process.env.SOCKETIO_PORT || 3000,
|
|
195
|
+
namespace: process.env.SOCKETIO_NAMESPACE || null,
|
|
196
|
+
server: null,
|
|
197
|
+
...opts
|
|
198
|
+
});
|
|
199
|
+
this.io = null;
|
|
200
|
+
this.onConnection = this.onConnection.bind(this);
|
|
201
|
+
this.commands = commands;
|
|
202
|
+
this.debug = createDebug('cuecue:socketio');
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
async onInit() {
|
|
206
|
+
await super.onInit();
|
|
207
|
+
await this.createServer();
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
async onDestroy() {
|
|
211
|
+
await this.closeSocket();
|
|
212
|
+
await super.onDestroy();
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
async connectSocket() {
|
|
216
|
+
const {
|
|
217
|
+
server,
|
|
218
|
+
port
|
|
219
|
+
} = this.options;
|
|
220
|
+
const ioOptions = {};
|
|
221
|
+
this.io = io$1(ioOptions);
|
|
222
|
+
this.io.on('connection', this.onConnection);
|
|
223
|
+
this.io.listen(server || port);
|
|
224
|
+
return Promise.resolve();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
async closeSocket() {
|
|
228
|
+
this.io.off('connection', this.onConnection);
|
|
229
|
+
return new Promise(resolve => {
|
|
230
|
+
this.io.close(() => {
|
|
231
|
+
resolve();
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
onConnection(socket) {
|
|
237
|
+
this.debug('Client connected %s', socket.id);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
class ServerInput extends BaseServer {
|
|
243
|
+
constructor({
|
|
244
|
+
commands = null,
|
|
245
|
+
...opts
|
|
246
|
+
} = {}) {
|
|
247
|
+
super({
|
|
248
|
+
namespace: process.env.SOCKETIO_INPUT_NAMESPACE || null,
|
|
249
|
+
...opts
|
|
250
|
+
});
|
|
251
|
+
this.onSocketConnection = this.onSocketConnection.bind(this);
|
|
252
|
+
this.onMessage = this.onMessage.bind(this);
|
|
253
|
+
this.commands = commands;
|
|
254
|
+
this.debug = createDebug('cuecue:input:socketio-server');
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
setInputCommands(commands) {
|
|
258
|
+
this.commands = commands;
|
|
259
|
+
return this;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
async onInit() {
|
|
263
|
+
await super.onInit();
|
|
264
|
+
const {
|
|
265
|
+
namespace
|
|
266
|
+
} = this.namespace;
|
|
267
|
+
|
|
268
|
+
if (namespace !== null) {
|
|
269
|
+
this.io.of(namespace).on('connection', this.onSocketConnection);
|
|
270
|
+
} else {
|
|
271
|
+
this.io.on('connection', this.onSocketConnection);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
async onDestroy() {
|
|
276
|
+
const {
|
|
277
|
+
namespace
|
|
278
|
+
} = this.namespace;
|
|
279
|
+
|
|
280
|
+
if (namespace !== null) {
|
|
281
|
+
this.io.of(namespace).off('connection', this.onSocketConnection);
|
|
282
|
+
} else {
|
|
283
|
+
this.io.off('connection', this.onSocketConnection);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
await super.onDestroy();
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
async onSocketConnection(socket) {
|
|
290
|
+
socket.on('message', this.onMessage);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
async onMessage(message) {
|
|
294
|
+
const {
|
|
295
|
+
transformMessage = null,
|
|
296
|
+
transformCommand = null
|
|
297
|
+
} = this.options;
|
|
298
|
+
const {
|
|
299
|
+
command = null,
|
|
300
|
+
args = []
|
|
301
|
+
} = (transformMessage !== null ? await transformMessage(message) : message) || {};
|
|
302
|
+
const {
|
|
303
|
+
command: finalCommand = command,
|
|
304
|
+
args: finalArgs = args
|
|
305
|
+
} = (transformCommand !== null ? await transformCommand(command, args) : null) || {};
|
|
306
|
+
|
|
307
|
+
if (this.commands === null || this.commands.indexOf(finalCommand) !== -1) {
|
|
308
|
+
this.debug('command: %s args: %o', finalCommand, finalArgs);
|
|
309
|
+
this.emit('command', command, ...(isArray(finalArgs) ? finalArgs : [finalArgs]));
|
|
310
|
+
} else {
|
|
311
|
+
this.debug('message: %o', message);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
class ServerOutput extends Base {
|
|
318
|
+
constructor(opts = {}) {
|
|
319
|
+
super({
|
|
320
|
+
namespace: process.env.SOCKETIO_OUTPUT_NAMESPACE || null,
|
|
321
|
+
...opts
|
|
322
|
+
});
|
|
323
|
+
this.socket = null;
|
|
324
|
+
this.debug = createDebug('cuecue:output:socketio');
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
cue(cue, extraData = null) {
|
|
328
|
+
this.command('cue', cue, extraData);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
cues(cues) {
|
|
332
|
+
this.command('cues', cues);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
interact(data, interactionId = null) {
|
|
336
|
+
this.command('interact', data, interactionId);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
interaction(interaction) {
|
|
340
|
+
this.command('interaction', interaction);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
uninteraction(interactionId) {
|
|
344
|
+
this.command('uninteract', interactionId);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
uninteractions(interactionIds) {
|
|
348
|
+
this.command('uninteractions', interactionIds);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
async command(command, ...args) {
|
|
352
|
+
const {
|
|
353
|
+
transformCommand = null,
|
|
354
|
+
transformMessage = null,
|
|
355
|
+
acceptCommand = null
|
|
356
|
+
} = this.options;
|
|
357
|
+
const value = transformCommand !== null ? await transformCommand(command, args) : {
|
|
358
|
+
command,
|
|
359
|
+
args
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
if (value === false) {
|
|
363
|
+
this.debug('command canceled: %s %o', command, args);
|
|
364
|
+
return Promise.resolve();
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
const {
|
|
368
|
+
command: finalCommand = command,
|
|
369
|
+
args: finalArgs = args,
|
|
370
|
+
namespace = null
|
|
371
|
+
} = value || {};
|
|
372
|
+
|
|
373
|
+
if (acceptCommand !== null && !acceptCommand(finalCommand, finalArgs)) {
|
|
374
|
+
this.debug('command refused: %s %o', finalCommand, finalArgs);
|
|
375
|
+
return Promise.resolve();
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
this.debug('command: %s message: %o', finalCommand, finalArgs);
|
|
379
|
+
const message = {
|
|
380
|
+
command: finalCommand,
|
|
381
|
+
args: finalArgs
|
|
382
|
+
};
|
|
383
|
+
const payload = transformMessage !== null ? await transformMessage(message) : message;
|
|
384
|
+
return namespace !== null ? this.sendToNamespace(payload) : this.send(payload);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
async send(...args) {
|
|
388
|
+
this.debug('send: %o', args);
|
|
389
|
+
const {
|
|
390
|
+
namespace = null
|
|
391
|
+
} = this.options;
|
|
392
|
+
|
|
393
|
+
if (namespace !== null) {
|
|
394
|
+
return this.sendToNamespace(namespace, ...args);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
this.io.send(...args);
|
|
398
|
+
return Promise.resolve();
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
async sendToNamespace(namespace, ...args) {
|
|
402
|
+
this.debug('send: %o', args);
|
|
403
|
+
this.io.of(namespace).send(...args);
|
|
404
|
+
return Promise.resolve();
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
export { ClientInput as Input, ClientOutput as Output, ServerInput, ServerOutput };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cuecue/socketio",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.27",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -29,16 +29,18 @@
|
|
|
29
29
|
}
|
|
30
30
|
],
|
|
31
31
|
"license": "ISC",
|
|
32
|
-
"main": "
|
|
32
|
+
"main": "dist/index.js",
|
|
33
33
|
"files": [
|
|
34
|
-
"
|
|
34
|
+
"dist"
|
|
35
35
|
],
|
|
36
36
|
"scripts": {
|
|
37
|
-
"
|
|
37
|
+
"clean": "rm -rf dist",
|
|
38
|
+
"build": "rollup --config ../../rollup.config.js",
|
|
39
|
+
"prepare": "npm run clean && npm run build"
|
|
38
40
|
},
|
|
39
41
|
"dependencies": {
|
|
40
42
|
"@babel/runtime": "^7.12.5",
|
|
41
|
-
"@cuecue/core": "^0.0.
|
|
43
|
+
"@cuecue/core": "^0.0.27",
|
|
42
44
|
"debug": "^4.3.1",
|
|
43
45
|
"lodash": "^4.17.20",
|
|
44
46
|
"socket.io": "^4.1.2",
|
|
@@ -48,5 +50,5 @@
|
|
|
48
50
|
"publishConfig": {
|
|
49
51
|
"access": "public"
|
|
50
52
|
},
|
|
51
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "2c305c0d1c0b13469fe74e2b928c0b45744c8ac0"
|
|
52
54
|
}
|
package/lib/index.js
DELETED
|
@@ -1,572 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
6
|
-
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
7
|
-
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
8
|
-
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
9
|
-
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
10
|
-
var _classCallCheck = require('@babel/runtime/helpers/classCallCheck');
|
|
11
|
-
var _createClass = require('@babel/runtime/helpers/createClass');
|
|
12
|
-
var _assertThisInitialized = require('@babel/runtime/helpers/assertThisInitialized');
|
|
13
|
-
var _get = require('@babel/runtime/helpers/get');
|
|
14
|
-
var _getPrototypeOf = require('@babel/runtime/helpers/getPrototypeOf');
|
|
15
|
-
var _inherits = require('@babel/runtime/helpers/inherits');
|
|
16
|
-
var _createSuper = require('@babel/runtime/helpers/createSuper');
|
|
17
|
-
var createDebug = require('debug');
|
|
18
|
-
var isArray = require('lodash/isArray');
|
|
19
|
-
var core = require('@cuecue/core');
|
|
20
|
-
var socket_ioClient = require('socket.io-client');
|
|
21
|
-
|
|
22
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
23
|
-
|
|
24
|
-
var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
|
|
25
|
-
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
|
|
26
|
-
var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
|
|
27
|
-
var _objectSpread__default = /*#__PURE__*/_interopDefaultLegacy(_objectSpread);
|
|
28
|
-
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
29
|
-
var _classCallCheck__default = /*#__PURE__*/_interopDefaultLegacy(_classCallCheck);
|
|
30
|
-
var _createClass__default = /*#__PURE__*/_interopDefaultLegacy(_createClass);
|
|
31
|
-
var _assertThisInitialized__default = /*#__PURE__*/_interopDefaultLegacy(_assertThisInitialized);
|
|
32
|
-
var _get__default = /*#__PURE__*/_interopDefaultLegacy(_get);
|
|
33
|
-
var _getPrototypeOf__default = /*#__PURE__*/_interopDefaultLegacy(_getPrototypeOf);
|
|
34
|
-
var _inherits__default = /*#__PURE__*/_interopDefaultLegacy(_inherits);
|
|
35
|
-
var _createSuper__default = /*#__PURE__*/_interopDefaultLegacy(_createSuper);
|
|
36
|
-
var createDebug__default = /*#__PURE__*/_interopDefaultLegacy(createDebug);
|
|
37
|
-
var isArray__default = /*#__PURE__*/_interopDefaultLegacy(isArray);
|
|
38
|
-
|
|
39
|
-
var Base = /*#__PURE__*/function (_BasePlugin) {
|
|
40
|
-
_inherits__default['default'](Base, _BasePlugin);
|
|
41
|
-
|
|
42
|
-
var _super = _createSuper__default['default'](Base);
|
|
43
|
-
|
|
44
|
-
function Base() {
|
|
45
|
-
var _this;
|
|
46
|
-
|
|
47
|
-
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
48
|
-
_ref$commands = _ref.commands,
|
|
49
|
-
commands = _ref$commands === void 0 ? null : _ref$commands,
|
|
50
|
-
opts = _objectWithoutProperties__default['default'](_ref, ["commands"]);
|
|
51
|
-
|
|
52
|
-
_classCallCheck__default['default'](this, Base);
|
|
53
|
-
|
|
54
|
-
_this = _super.call(this, _objectSpread__default['default']({
|
|
55
|
-
host: process.env.SOCKETIO_HOST || 'localhost',
|
|
56
|
-
namespace: process.env.SOCKETIO_NAMESPACE || null
|
|
57
|
-
}, opts));
|
|
58
|
-
_this.commands = commands;
|
|
59
|
-
_this.debug = createDebug__default['default']('cuecue:socketio');
|
|
60
|
-
return _this;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
_createClass__default['default'](Base, [{
|
|
64
|
-
key: "onInit",
|
|
65
|
-
value: function () {
|
|
66
|
-
var _onInit = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
|
|
67
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
|
68
|
-
while (1) {
|
|
69
|
-
switch (_context.prev = _context.next) {
|
|
70
|
-
case 0:
|
|
71
|
-
_context.next = 2;
|
|
72
|
-
return _get__default['default'](_getPrototypeOf__default['default'](Base.prototype), "onInit", this).call(this);
|
|
73
|
-
|
|
74
|
-
case 2:
|
|
75
|
-
_context.next = 4;
|
|
76
|
-
return this.connectSocket();
|
|
77
|
-
|
|
78
|
-
case 4:
|
|
79
|
-
case "end":
|
|
80
|
-
return _context.stop();
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}, _callee, this);
|
|
84
|
-
}));
|
|
85
|
-
|
|
86
|
-
function onInit() {
|
|
87
|
-
return _onInit.apply(this, arguments);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return onInit;
|
|
91
|
-
}()
|
|
92
|
-
}, {
|
|
93
|
-
key: "onDestroy",
|
|
94
|
-
value: function () {
|
|
95
|
-
var _onDestroy = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2() {
|
|
96
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
|
97
|
-
while (1) {
|
|
98
|
-
switch (_context2.prev = _context2.next) {
|
|
99
|
-
case 0:
|
|
100
|
-
_context2.next = 2;
|
|
101
|
-
return this.closeSocket();
|
|
102
|
-
|
|
103
|
-
case 2:
|
|
104
|
-
_context2.next = 4;
|
|
105
|
-
return _get__default['default'](_getPrototypeOf__default['default'](Base.prototype), "onDestroy", this).call(this);
|
|
106
|
-
|
|
107
|
-
case 4:
|
|
108
|
-
case "end":
|
|
109
|
-
return _context2.stop();
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}, _callee2, this);
|
|
113
|
-
}));
|
|
114
|
-
|
|
115
|
-
function onDestroy() {
|
|
116
|
-
return _onDestroy.apply(this, arguments);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return onDestroy;
|
|
120
|
-
}()
|
|
121
|
-
}, {
|
|
122
|
-
key: "connectSocket",
|
|
123
|
-
value: function () {
|
|
124
|
-
var _connectSocket = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3() {
|
|
125
|
-
var _this2 = this;
|
|
126
|
-
|
|
127
|
-
var _this$options, host, namespace;
|
|
128
|
-
|
|
129
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
|
130
|
-
while (1) {
|
|
131
|
-
switch (_context3.prev = _context3.next) {
|
|
132
|
-
case 0:
|
|
133
|
-
_this$options = this.options, host = _this$options.host, namespace = _this$options.namespace;
|
|
134
|
-
return _context3.abrupt("return", new Promise(function (resolve) {
|
|
135
|
-
_this2.socket = socket_ioClient.io(namespace !== null ? host.replace(/\/$/, "/".concat(namespace.replace(/^\//, ''))) : host);
|
|
136
|
-
|
|
137
|
-
_this2.socket.once('connect', function () {
|
|
138
|
-
resolve();
|
|
139
|
-
});
|
|
140
|
-
}));
|
|
141
|
-
|
|
142
|
-
case 2:
|
|
143
|
-
case "end":
|
|
144
|
-
return _context3.stop();
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}, _callee3, this);
|
|
148
|
-
}));
|
|
149
|
-
|
|
150
|
-
function connectSocket() {
|
|
151
|
-
return _connectSocket.apply(this, arguments);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return connectSocket;
|
|
155
|
-
}()
|
|
156
|
-
}, {
|
|
157
|
-
key: "closeSocket",
|
|
158
|
-
value: function () {
|
|
159
|
-
var _closeSocket = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee4() {
|
|
160
|
-
var _this3 = this;
|
|
161
|
-
|
|
162
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee4$(_context4) {
|
|
163
|
-
while (1) {
|
|
164
|
-
switch (_context4.prev = _context4.next) {
|
|
165
|
-
case 0:
|
|
166
|
-
return _context4.abrupt("return", new Promise(function (resolve) {
|
|
167
|
-
_this3.socket.once('disconnect', function () {
|
|
168
|
-
resolve();
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
_this3.socket.close();
|
|
172
|
-
}));
|
|
173
|
-
|
|
174
|
-
case 1:
|
|
175
|
-
case "end":
|
|
176
|
-
return _context4.stop();
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}, _callee4);
|
|
180
|
-
}));
|
|
181
|
-
|
|
182
|
-
function closeSocket() {
|
|
183
|
-
return _closeSocket.apply(this, arguments);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
return closeSocket;
|
|
187
|
-
}()
|
|
188
|
-
}]);
|
|
189
|
-
|
|
190
|
-
return Base;
|
|
191
|
-
}(core.BasePlugin);
|
|
192
|
-
|
|
193
|
-
var SocketIOInput = /*#__PURE__*/function (_Base) {
|
|
194
|
-
_inherits__default['default'](SocketIOInput, _Base);
|
|
195
|
-
|
|
196
|
-
var _super = _createSuper__default['default'](SocketIOInput);
|
|
197
|
-
|
|
198
|
-
function SocketIOInput() {
|
|
199
|
-
var _this;
|
|
200
|
-
|
|
201
|
-
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
202
|
-
_ref$commands = _ref.commands,
|
|
203
|
-
commands = _ref$commands === void 0 ? null : _ref$commands,
|
|
204
|
-
opts = _objectWithoutProperties__default['default'](_ref, ["commands"]);
|
|
205
|
-
|
|
206
|
-
_classCallCheck__default['default'](this, SocketIOInput);
|
|
207
|
-
|
|
208
|
-
_this = _super.call(this, _objectSpread__default['default']({
|
|
209
|
-
namespace: process.env.SOCKETIO_INPUT_NAMESPACE || null
|
|
210
|
-
}, opts));
|
|
211
|
-
_this.onMessage = _this.onMessage.bind(_assertThisInitialized__default['default'](_this));
|
|
212
|
-
_this.commands = commands;
|
|
213
|
-
_this.debug = createDebug__default['default']('cuecue:input:socketio');
|
|
214
|
-
return _this;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
_createClass__default['default'](SocketIOInput, [{
|
|
218
|
-
key: "setInputCommands",
|
|
219
|
-
value: function setInputCommands(commands) {
|
|
220
|
-
this.commands = commands;
|
|
221
|
-
return this;
|
|
222
|
-
}
|
|
223
|
-
}, {
|
|
224
|
-
key: "onInit",
|
|
225
|
-
value: function () {
|
|
226
|
-
var _onInit = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
|
|
227
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
|
228
|
-
while (1) {
|
|
229
|
-
switch (_context.prev = _context.next) {
|
|
230
|
-
case 0:
|
|
231
|
-
_context.next = 2;
|
|
232
|
-
return _get__default['default'](_getPrototypeOf__default['default'](SocketIOInput.prototype), "onInit", this).call(this);
|
|
233
|
-
|
|
234
|
-
case 2:
|
|
235
|
-
this.socket.on('message', this.onMessage);
|
|
236
|
-
|
|
237
|
-
case 3:
|
|
238
|
-
case "end":
|
|
239
|
-
return _context.stop();
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}, _callee, this);
|
|
243
|
-
}));
|
|
244
|
-
|
|
245
|
-
function onInit() {
|
|
246
|
-
return _onInit.apply(this, arguments);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
return onInit;
|
|
250
|
-
}()
|
|
251
|
-
}, {
|
|
252
|
-
key: "onDestroy",
|
|
253
|
-
value: function () {
|
|
254
|
-
var _onDestroy = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2() {
|
|
255
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
|
256
|
-
while (1) {
|
|
257
|
-
switch (_context2.prev = _context2.next) {
|
|
258
|
-
case 0:
|
|
259
|
-
this.socket.off('message', this.onMessage);
|
|
260
|
-
_context2.next = 3;
|
|
261
|
-
return _get__default['default'](_getPrototypeOf__default['default'](SocketIOInput.prototype), "onDestroy", this).call(this);
|
|
262
|
-
|
|
263
|
-
case 3:
|
|
264
|
-
case "end":
|
|
265
|
-
return _context2.stop();
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
}, _callee2, this);
|
|
269
|
-
}));
|
|
270
|
-
|
|
271
|
-
function onDestroy() {
|
|
272
|
-
return _onDestroy.apply(this, arguments);
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
return onDestroy;
|
|
276
|
-
}()
|
|
277
|
-
}, {
|
|
278
|
-
key: "onMessage",
|
|
279
|
-
value: function () {
|
|
280
|
-
var _onMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3(message) {
|
|
281
|
-
var _this$options, _this$options$transfo, transformMessage, _this$options$transfo2, transformCommand, _ref2, _ref2$command, command, _ref2$args, args, _ref3, _ref3$command, finalCommand, _ref3$args, finalArgs;
|
|
282
|
-
|
|
283
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
|
284
|
-
while (1) {
|
|
285
|
-
switch (_context3.prev = _context3.next) {
|
|
286
|
-
case 0:
|
|
287
|
-
_this$options = this.options, _this$options$transfo = _this$options.transformMessage, transformMessage = _this$options$transfo === void 0 ? null : _this$options$transfo, _this$options$transfo2 = _this$options.transformCommand, transformCommand = _this$options$transfo2 === void 0 ? null : _this$options$transfo2;
|
|
288
|
-
|
|
289
|
-
if (!(transformMessage !== null)) {
|
|
290
|
-
_context3.next = 7;
|
|
291
|
-
break;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
_context3.next = 4;
|
|
295
|
-
return transformMessage(message);
|
|
296
|
-
|
|
297
|
-
case 4:
|
|
298
|
-
_context3.t1 = _context3.sent;
|
|
299
|
-
_context3.next = 8;
|
|
300
|
-
break;
|
|
301
|
-
|
|
302
|
-
case 7:
|
|
303
|
-
_context3.t1 = message;
|
|
304
|
-
|
|
305
|
-
case 8:
|
|
306
|
-
_context3.t0 = _context3.t1;
|
|
307
|
-
|
|
308
|
-
if (_context3.t0) {
|
|
309
|
-
_context3.next = 11;
|
|
310
|
-
break;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
_context3.t0 = {};
|
|
314
|
-
|
|
315
|
-
case 11:
|
|
316
|
-
_ref2 = _context3.t0;
|
|
317
|
-
_ref2$command = _ref2.command;
|
|
318
|
-
command = _ref2$command === void 0 ? null : _ref2$command;
|
|
319
|
-
_ref2$args = _ref2.args;
|
|
320
|
-
args = _ref2$args === void 0 ? [] : _ref2$args;
|
|
321
|
-
|
|
322
|
-
if (!(transformCommand !== null)) {
|
|
323
|
-
_context3.next = 22;
|
|
324
|
-
break;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
_context3.next = 19;
|
|
328
|
-
return transformCommand(command, args);
|
|
329
|
-
|
|
330
|
-
case 19:
|
|
331
|
-
_context3.t3 = _context3.sent;
|
|
332
|
-
_context3.next = 23;
|
|
333
|
-
break;
|
|
334
|
-
|
|
335
|
-
case 22:
|
|
336
|
-
_context3.t3 = null;
|
|
337
|
-
|
|
338
|
-
case 23:
|
|
339
|
-
_context3.t2 = _context3.t3;
|
|
340
|
-
|
|
341
|
-
if (_context3.t2) {
|
|
342
|
-
_context3.next = 26;
|
|
343
|
-
break;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
_context3.t2 = {};
|
|
347
|
-
|
|
348
|
-
case 26:
|
|
349
|
-
_ref3 = _context3.t2;
|
|
350
|
-
_ref3$command = _ref3.command;
|
|
351
|
-
finalCommand = _ref3$command === void 0 ? command : _ref3$command;
|
|
352
|
-
_ref3$args = _ref3.args;
|
|
353
|
-
finalArgs = _ref3$args === void 0 ? args : _ref3$args;
|
|
354
|
-
|
|
355
|
-
if (this.commands === null || this.commands.indexOf(finalCommand) !== -1) {
|
|
356
|
-
this.debug('command: %s args: %o', finalCommand, finalArgs);
|
|
357
|
-
this.emit.apply(this, ['command', command].concat(_toConsumableArray__default['default'](isArray__default['default'](finalArgs) ? finalArgs : [finalArgs])));
|
|
358
|
-
} else {
|
|
359
|
-
this.debug('message: %o', message);
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
case 32:
|
|
363
|
-
case "end":
|
|
364
|
-
return _context3.stop();
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
}, _callee3, this);
|
|
368
|
-
}));
|
|
369
|
-
|
|
370
|
-
function onMessage(_x) {
|
|
371
|
-
return _onMessage.apply(this, arguments);
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
return onMessage;
|
|
375
|
-
}()
|
|
376
|
-
}]);
|
|
377
|
-
|
|
378
|
-
return SocketIOInput;
|
|
379
|
-
}(Base);
|
|
380
|
-
|
|
381
|
-
var SocketIOOutput = /*#__PURE__*/function (_Base) {
|
|
382
|
-
_inherits__default['default'](SocketIOOutput, _Base);
|
|
383
|
-
|
|
384
|
-
var _super = _createSuper__default['default'](SocketIOOutput);
|
|
385
|
-
|
|
386
|
-
function SocketIOOutput() {
|
|
387
|
-
var _this;
|
|
388
|
-
|
|
389
|
-
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
390
|
-
|
|
391
|
-
_classCallCheck__default['default'](this, SocketIOOutput);
|
|
392
|
-
|
|
393
|
-
_this = _super.call(this, _objectSpread__default['default']({
|
|
394
|
-
namespace: process.env.SOCKETIO_OUTPUT_NAMESPACE || null
|
|
395
|
-
}, opts));
|
|
396
|
-
_this.socket = null;
|
|
397
|
-
_this.debug = createDebug__default['default']('cuecue:output:socketio');
|
|
398
|
-
return _this;
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
_createClass__default['default'](SocketIOOutput, [{
|
|
402
|
-
key: "cue",
|
|
403
|
-
value: function cue(_cue) {
|
|
404
|
-
var extraData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
405
|
-
this.command('cue', _cue, extraData);
|
|
406
|
-
}
|
|
407
|
-
}, {
|
|
408
|
-
key: "cues",
|
|
409
|
-
value: function cues(_cues) {
|
|
410
|
-
this.command('cues', _cues);
|
|
411
|
-
}
|
|
412
|
-
}, {
|
|
413
|
-
key: "interact",
|
|
414
|
-
value: function interact(data) {
|
|
415
|
-
var interactionId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
416
|
-
this.command('interact', data, interactionId);
|
|
417
|
-
}
|
|
418
|
-
}, {
|
|
419
|
-
key: "interaction",
|
|
420
|
-
value: function interaction(_interaction) {
|
|
421
|
-
this.command('interaction', _interaction);
|
|
422
|
-
}
|
|
423
|
-
}, {
|
|
424
|
-
key: "uninteraction",
|
|
425
|
-
value: function uninteraction(interactionId) {
|
|
426
|
-
this.command('uninteract', interactionId);
|
|
427
|
-
}
|
|
428
|
-
}, {
|
|
429
|
-
key: "uninteractions",
|
|
430
|
-
value: function uninteractions(interactionIds) {
|
|
431
|
-
this.command('uninteractions', interactionIds);
|
|
432
|
-
}
|
|
433
|
-
}, {
|
|
434
|
-
key: "command",
|
|
435
|
-
value: function () {
|
|
436
|
-
var _command2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(_command) {
|
|
437
|
-
var _this$options,
|
|
438
|
-
_this$options$transfo,
|
|
439
|
-
transformCommand,
|
|
440
|
-
_this$options$transfo2,
|
|
441
|
-
transformMessage,
|
|
442
|
-
_len,
|
|
443
|
-
args,
|
|
444
|
-
_key,
|
|
445
|
-
value,
|
|
446
|
-
_ref,
|
|
447
|
-
_ref$command,
|
|
448
|
-
finalCommand,
|
|
449
|
-
_ref$args,
|
|
450
|
-
finalArgs,
|
|
451
|
-
message,
|
|
452
|
-
payload,
|
|
453
|
-
_args = arguments;
|
|
454
|
-
|
|
455
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
|
456
|
-
while (1) {
|
|
457
|
-
switch (_context.prev = _context.next) {
|
|
458
|
-
case 0:
|
|
459
|
-
_this$options = this.options, _this$options$transfo = _this$options.transformCommand, transformCommand = _this$options$transfo === void 0 ? null : _this$options$transfo, _this$options$transfo2 = _this$options.transformMessage, transformMessage = _this$options$transfo2 === void 0 ? null : _this$options$transfo2;
|
|
460
|
-
|
|
461
|
-
for (_len = _args.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
462
|
-
args[_key - 1] = _args[_key];
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
if (!(transformCommand !== null)) {
|
|
466
|
-
_context.next = 8;
|
|
467
|
-
break;
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
_context.next = 5;
|
|
471
|
-
return transformCommand(_command, args);
|
|
472
|
-
|
|
473
|
-
case 5:
|
|
474
|
-
_context.t0 = _context.sent;
|
|
475
|
-
_context.next = 9;
|
|
476
|
-
break;
|
|
477
|
-
|
|
478
|
-
case 8:
|
|
479
|
-
_context.t0 = {
|
|
480
|
-
command: _command,
|
|
481
|
-
args: args
|
|
482
|
-
};
|
|
483
|
-
|
|
484
|
-
case 9:
|
|
485
|
-
value = _context.t0;
|
|
486
|
-
|
|
487
|
-
if (!(value === false)) {
|
|
488
|
-
_context.next = 13;
|
|
489
|
-
break;
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
this.debug('command canceled: %s %o', _command, args);
|
|
493
|
-
return _context.abrupt("return", Promise.resolve());
|
|
494
|
-
|
|
495
|
-
case 13:
|
|
496
|
-
_ref = value || {}, _ref$command = _ref.command, finalCommand = _ref$command === void 0 ? _command : _ref$command, _ref$args = _ref.args, finalArgs = _ref$args === void 0 ? args : _ref$args;
|
|
497
|
-
this.debug('command: %s message: %o', finalCommand, finalArgs);
|
|
498
|
-
message = {
|
|
499
|
-
command: finalCommand,
|
|
500
|
-
args: finalArgs
|
|
501
|
-
};
|
|
502
|
-
|
|
503
|
-
if (!(transformMessage !== null)) {
|
|
504
|
-
_context.next = 22;
|
|
505
|
-
break;
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
_context.next = 19;
|
|
509
|
-
return transformMessage(message);
|
|
510
|
-
|
|
511
|
-
case 19:
|
|
512
|
-
_context.t1 = _context.sent;
|
|
513
|
-
_context.next = 23;
|
|
514
|
-
break;
|
|
515
|
-
|
|
516
|
-
case 22:
|
|
517
|
-
_context.t1 = message;
|
|
518
|
-
|
|
519
|
-
case 23:
|
|
520
|
-
payload = _context.t1;
|
|
521
|
-
return _context.abrupt("return", this.send(payload));
|
|
522
|
-
|
|
523
|
-
case 25:
|
|
524
|
-
case "end":
|
|
525
|
-
return _context.stop();
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
}, _callee, this);
|
|
529
|
-
}));
|
|
530
|
-
|
|
531
|
-
function command(_x) {
|
|
532
|
-
return _command2.apply(this, arguments);
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
return command;
|
|
536
|
-
}()
|
|
537
|
-
}, {
|
|
538
|
-
key: "send",
|
|
539
|
-
value: function () {
|
|
540
|
-
var _send = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2() {
|
|
541
|
-
var _this$socket;
|
|
542
|
-
|
|
543
|
-
var _args2 = arguments;
|
|
544
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
|
545
|
-
while (1) {
|
|
546
|
-
switch (_context2.prev = _context2.next) {
|
|
547
|
-
case 0:
|
|
548
|
-
(_this$socket = this.socket).send.apply(_this$socket, _args2);
|
|
549
|
-
|
|
550
|
-
return _context2.abrupt("return", Promise.resolve());
|
|
551
|
-
|
|
552
|
-
case 2:
|
|
553
|
-
case "end":
|
|
554
|
-
return _context2.stop();
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
}, _callee2, this);
|
|
558
|
-
}));
|
|
559
|
-
|
|
560
|
-
function send() {
|
|
561
|
-
return _send.apply(this, arguments);
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
return send;
|
|
565
|
-
}()
|
|
566
|
-
}]);
|
|
567
|
-
|
|
568
|
-
return SocketIOOutput;
|
|
569
|
-
}(Base);
|
|
570
|
-
|
|
571
|
-
exports.Input = SocketIOInput;
|
|
572
|
-
exports.Output = SocketIOOutput;
|