plum-e2e 2.9.7 β†’ 2.9.8

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.
@@ -43,12 +43,10 @@ function wireRealtimeServices(io, isNodeMode) {
43
43
  if (isNodeMode) return { cronService: null, backupCronService: null };
44
44
 
45
45
  const socketHandler = require('../websockets/socketHandler.js');
46
- const nodeSocketHandler = require('../websockets/nodeSocketHandler.js');
47
46
  const cronService = require('../services/cronService');
48
47
  const backupCronService = require('../services/backupCronService');
49
48
 
50
49
  socketHandler(io);
51
- nodeSocketHandler(io);
52
50
  cronService.setSocketIO(io);
53
51
  require('../routes/trigger.routes').setSocketIO(io);
54
52
 
@@ -0,0 +1,6 @@
1
+ /*
2
+ This file is part of Plum.
3
+ Licensed under the MIT License. See LICENSE file in the project root for details.
4
+ */
5
+ πŸ“‚ Loading tests from: /Users/silverlunah/Projects/plum/backend/tests
6
+ Backend running on port 3055 (node/runner mode)
@@ -26,8 +26,7 @@
26
26
  "node-cron": "^3.0.3",
27
27
  "picocolors": "^1.1.1",
28
28
  "playwright": "1.50.1",
29
- "socket.io": "^4.8.1",
30
- "socket.io-client": "^4.8.3"
29
+ "socket.io": "^4.8.1"
31
30
  },
32
31
  "devDependencies": {
33
32
  "@playwright/test": "1.50.1",
@@ -2385,40 +2384,6 @@
2385
2384
  "node": ">=10.2.0"
2386
2385
  }
2387
2386
  },
2388
- "node_modules/engine.io-client": {
2389
- "version": "6.6.6",
2390
- "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.6.6.tgz",
2391
- "integrity": "sha512-iY6QdftLQ9pyiPoX082bpf/u1UewnOaJrtJIF9T0++QB34lZrj0uP+Q/bj8AlUsAxqhnkTV2BS8SBZSxOmoV5Q==",
2392
- "license": "MIT",
2393
- "dependencies": {
2394
- "@socket.io/component-emitter": "~3.1.0",
2395
- "debug": "~4.4.1",
2396
- "engine.io-parser": "~5.2.1",
2397
- "ws": "~8.21.0",
2398
- "xmlhttprequest-ssl": "~2.1.1"
2399
- }
2400
- },
2401
- "node_modules/engine.io-client/node_modules/ws": {
2402
- "version": "8.21.3",
2403
- "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.3.tgz",
2404
- "integrity": "sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw==",
2405
- "license": "MIT",
2406
- "engines": {
2407
- "node": ">=10.0.0"
2408
- },
2409
- "peerDependencies": {
2410
- "bufferutil": "^4.0.1",
2411
- "utf-8-validate": ">=5.0.2"
2412
- },
2413
- "peerDependenciesMeta": {
2414
- "bufferutil": {
2415
- "optional": true
2416
- },
2417
- "utf-8-validate": {
2418
- "optional": true
2419
- }
2420
- }
2421
- },
2422
2387
  "node_modules/engine.io-parser": {
2423
2388
  "version": "5.2.3",
2424
2389
  "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.3.tgz",
@@ -4328,21 +4293,6 @@
4328
4293
  }
4329
4294
  }
4330
4295
  },
4331
- "node_modules/socket.io-client": {
4332
- "version": "4.8.3",
4333
- "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.8.3.tgz",
4334
- "integrity": "sha512-uP0bpjWrjQmUt5DTHq9RuoCBdFJF10cdX9X+a368j/Ft0wmaVgxlrjvK3kjvgCODOMMOz9lcaRzxmso0bTWZ/g==",
4335
- "license": "MIT",
4336
- "dependencies": {
4337
- "@socket.io/component-emitter": "~3.1.0",
4338
- "debug": "~4.4.1",
4339
- "engine.io-client": "~6.6.1",
4340
- "socket.io-parser": "~4.2.4"
4341
- },
4342
- "engines": {
4343
- "node": ">=10.0.0"
4344
- }
4345
- },
4346
4296
  "node_modules/socket.io-parser": {
4347
4297
  "version": "4.2.4",
4348
4298
  "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.4.tgz",
@@ -4980,14 +4930,6 @@
4980
4930
  "node": ">=8.0"
4981
4931
  }
4982
4932
  },
4983
- "node_modules/xmlhttprequest-ssl": {
4984
- "version": "2.1.2",
4985
- "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.1.2.tgz",
4986
- "integrity": "sha512-TEU+nJVUUnA4CYJFLvK5X9AOeH4KvDvhIfm0vV1GaQRtchnG0hgK5p8hw/xjv8cunWYCsiPCSDzObPyhEwq3KQ==",
4987
- "engines": {
4988
- "node": ">=0.4.0"
4989
- }
4990
- },
4991
4933
  "node_modules/yallist": {
4992
4934
  "version": "4.0.0",
4993
4935
  "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
@@ -39,7 +39,6 @@
39
39
  "node-cron": "^3.0.3",
40
40
  "picocolors": "^1.1.1",
41
41
  "playwright": "1.50.1",
42
- "socket.io": "^4.8.1",
43
- "socket.io-client": "^4.8.3"
42
+ "socket.io": "^4.8.1"
44
43
  }
45
44
  }
@@ -19,6 +19,7 @@ import * as clack from '@clack/prompts';
19
19
  import pc from 'picocolors';
20
20
  import runnerProcess from '../lib/runnerProcess.js';
21
21
  import nodeRegister from '../lib/nodeRegister.js';
22
+ import globalRegistry from '../lib/globalRegistry.js';
22
23
 
23
24
  const {
24
25
  isLocalUrl,
@@ -37,13 +38,22 @@ const API_URL = process.env.PLUM_API_URL || 'http://localhost:3001';
37
38
 
38
39
  const cancelled = (v) => clack.isCancel(v);
39
40
 
40
- // The mutating /runners routes accept a registered runner's own token in place
41
- // of an admin session β€” this manager has no browser/JWT to present, but a node
42
- // already gets a token at registration time (see backend/middleware/jwtAuth.js
43
- // / runnerOrAdmin.js), so reuse that instead of a separate credential.
44
- const localToken = loadNodeConfig(process.cwd()).token;
41
+ // The mutating /runners routes take a registered runner's own token in place of
42
+ // an admin session (runnerOrAdmin.js), and this manager has no JWT β€” so find
43
+ // any node token on this machine, falling back to PLUM_MCP_KEY.
44
+ function resolveAuthHeader() {
45
+ const cwdToken = loadNodeConfig(process.cwd()).token;
46
+ if (cwdToken) return { Authorization: `Bearer ${cwdToken}` };
47
+ for (const dir of globalRegistry.getInstalls('node')) {
48
+ const token = loadNodeConfig(dir).token;
49
+ if (token) return { Authorization: `Bearer ${token}` };
50
+ }
51
+ if (process.env.PLUM_MCP_KEY) return { Authorization: `ApiKey ${process.env.PLUM_MCP_KEY}` };
52
+ return {};
53
+ }
54
+ const AUTH_HEADER = resolveAuthHeader();
45
55
  function authHeaders() {
46
- return localToken ? { Authorization: `Bearer ${localToken}` } : {};
56
+ return AUTH_HEADER;
47
57
  }
48
58
 
49
59
  /**
@@ -291,6 +301,26 @@ async function runAction(r) {
291
301
  }
292
302
  }
293
303
 
304
+ // Polls a node's own /api/ping until it reports mode:'node' or the timeout
305
+ // elapses β€” used to confirm a runner actually serves before its registration
306
+ // is kept (see addRunner).
307
+ async function nodeIsUp(baseUrl, token, timeoutMs) {
308
+ const url = `${baseUrl.replace(/\/+$/, '')}/api/ping`;
309
+ const headers = token ? { Authorization: `Bearer ${token}` } : {};
310
+ const deadline = Date.now() + timeoutMs;
311
+ while (Date.now() < deadline) {
312
+ try {
313
+ const res = await fetch(url, { headers, signal: AbortSignal.timeout(3000) });
314
+ if (res.ok) {
315
+ const body = await res.json().catch(() => ({}));
316
+ if (body.ok && body.mode === 'node') return true;
317
+ }
318
+ } catch {}
319
+ await new Promise((r) => setTimeout(r, 750));
320
+ }
321
+ return false;
322
+ }
323
+
294
324
  async function addRunner() {
295
325
  const suggested = `node-${generateToken().slice(0, 6)}`;
296
326
 
@@ -301,12 +331,18 @@ async function addRunner() {
301
331
  });
302
332
  if (cancelled(name)) return;
303
333
 
304
- const port = await clack.text({
305
- message: 'Local port the node listens on',
306
- placeholder: '3002',
307
- defaultValue: '3002'
308
- });
309
- if (cancelled(port)) return;
334
+ let port;
335
+ for (;;) {
336
+ port = await clack.text({
337
+ message: 'Local port the node listens on',
338
+ placeholder: '3002',
339
+ defaultValue: '3002'
340
+ });
341
+ if (cancelled(port)) return;
342
+ const pid = findPidOnPort(Number(port));
343
+ if (!pid) break;
344
+ clack.log.warn(pc.yellow(`Port ${port} is already in use (pid ${pid}) β€” choose another.`));
345
+ }
310
346
 
311
347
  const defToken = process.env.NODE_TOKEN || generateToken();
312
348
  const token = await clack.text({
@@ -325,41 +361,75 @@ async function addRunner() {
325
361
  if (cancelled(urlInput)) return;
326
362
 
327
363
  const url = resolveNodeUrl(urlInput || defaultUrl);
364
+ const local = isLocalUrl(url);
328
365
 
329
366
  const s = clack.spinner();
330
367
  s.start(`Registering "${name}" with the primary...`);
331
- let id;
368
+ let id, reused;
332
369
  try {
333
- const res = await registerWithPrimary({
370
+ ({ id, reused } = await registerWithPrimary({
334
371
  primary: API_URL,
335
372
  name,
336
373
  url,
337
374
  token,
338
375
  browser: 'chromium'
339
- });
340
- id = res.id;
376
+ }));
341
377
  s.stop(
342
- res.reused
343
- ? pc.green(`Reusing existing runner "${name}"`)
344
- : pc.green(`Registered "${name}" (id ${id})`)
378
+ reused ? pc.green(`Reusing existing runner "${name}"`) : pc.green(`Registered "${name}"`)
345
379
  );
346
380
  } catch (e) {
347
381
  s.stop(pc.red(`Could not register "${name}": ${e.message}`));
348
382
  return;
349
383
  }
350
384
 
351
- prepareNodeEnv();
385
+ // Verify the node actually answers before keeping the registration β€” start a
386
+ // local one here, expect a remote one to already be up. A failed check rolls
387
+ // the registration back so no dead runner is left behind.
388
+ let entry = null;
389
+ let ok = false;
390
+ if (local) {
391
+ prepareNodeEnv();
392
+ entry = startNode({ id, port, token });
393
+ s.start(`Waiting for "${name}" to come up on port ${port}...`);
394
+ ok = await nodeIsUp(`http://localhost:${port}`, token, 20000);
395
+ s.stop(ok ? pc.green(`"${name}" is up (pid ${entry.pid})`) : pc.red(`"${name}" did not start`));
396
+ } else {
397
+ s.start(`Checking for a Plum node at ${url}...`);
398
+ ok = await nodeIsUp(url, token, 8000);
399
+ s.stop(ok ? pc.green(`"${name}" is reachable`) : pc.red(`No Plum node answered at ${url}`));
400
+ }
352
401
 
353
- const startNow = await clack.confirm({ message: 'Start this runner now?' });
354
- if (!cancelled(startNow) && startNow) {
355
- const entry = startNode({ id, port, token });
356
- clack.log.success(pc.green(`Started "${name}" on port ${port} (pid ${entry.pid})`));
402
+ if (ok) {
403
+ clack.log.success(pc.green(`Runner "${name}" is ready.`));
404
+ return;
357
405
  }
406
+
407
+ if (entry) stopNode(id, Number(port));
408
+ if (!reused) {
409
+ try {
410
+ await deleteRunner(id);
411
+ } catch {}
412
+ }
413
+ if (entry?.logFile) clack.note(entry.logFile, 'Node log');
414
+ clack.log.warn(
415
+ pc.yellow(
416
+ reused
417
+ ? `"${name}" stays registered but is unreachable β€” check the port/URL.`
418
+ : `"${name}" was not registered β€” check the port/URL and try again.`
419
+ )
420
+ );
358
421
  }
359
422
 
360
423
  async function main() {
361
424
  clack.intro(pc.bgMagenta(pc.white(' 🟣 Plum β€” Manage Runners ')));
362
425
 
426
+ if (!AUTH_HEADER.Authorization) {
427
+ clack.log.warn(
428
+ 'No runner credential found on this machine β€” stop / restart / delete will be rejected.\n' +
429
+ 'Run this from a folder where you started a node, or export PLUM_MCP_KEY.'
430
+ );
431
+ }
432
+
363
433
  for (;;) {
364
434
  const s = clack.spinner();
365
435
  s.start(`Loading runners from ${API_URL}...`);
@@ -8,7 +8,6 @@ const os = require('os');
8
8
  const path = require('path');
9
9
  const crypto = require('crypto');
10
10
  const { spawn } = require('child_process');
11
- const { io: ioClient } = require('socket.io-client');
12
11
  const { startRRwebPoller } = require('../lib/rrwebPoller');
13
12
  const { TRIGGER_REMOTE } = require('../constants/triggers');
14
13
  const { DEFAULT_BROWSER } = require('../constants/defaults');
@@ -24,40 +23,17 @@ function getJob(jobId) {
24
23
  return jobs[jobId];
25
24
  }
26
25
 
27
- // Opens this node's own outbound connection back to the primary for this job
28
- // β€” logs/rrweb events are pushed the moment they happen instead of waiting to
29
- // be polled. Uses the same token this node already validates incoming HTTP
30
- // calls against (see authGuard), so there's no separate credential to manage.
31
- // Best-effort: if the primary is unreachable this way, the job still runs β€”
32
- // dispatchAndPoll falls back to draining logs from the HTTP poll when it
33
- // never registered a socket relay for this jobId.
34
- function connectPrimaryStream(primaryUrl, jobId) {
35
- try {
36
- const socket = ioClient(`${primaryUrl}/node-stream`, {
37
- auth: { token: process.env.NODE_TOKEN },
38
- reconnectionAttempts: 5,
39
- timeout: 8000
40
- });
41
- socket.on('connect', () => socket.emit('join', jobId));
42
- return socket;
43
- } catch {
44
- return null;
45
- }
46
- }
47
-
48
26
  // Starts a remote test job dispatched from the primary server: materializes
49
- // any uploaded test files, spawns `npm run test`, and tracks logs for later
50
- // HTTP polling (see pollJob).
27
+ // any uploaded test files, spawns `npm run test`, and tracks logs + rrweb
28
+ // batches for HTTP polling (see pollJob).
51
29
  function startJob({
52
30
  tags,
53
31
  browser = DEFAULT_BROWSER,
54
32
  workers = 1,
55
33
  tests = null,
56
- env: userEnv = {},
57
- primaryUrl = null
34
+ env: userEnv = {}
58
35
  }) {
59
36
  const jobId = crypto.randomUUID();
60
- const primaryStream = primaryUrl ? connectPrimaryStream(primaryUrl, jobId) : null;
61
37
 
62
38
  // path.resolve ensures absolute even if TMPDIR env var is set to a relative path
63
39
  const tmpdir = path.resolve(os.tmpdir());
@@ -82,8 +58,7 @@ function startJob({
82
58
  jobs[jobId] = {
83
59
  status: JOB_STATUS.RUNNING,
84
60
  logs: '',
85
- // Drained by pollJob β€” the HTTP-poll fallback for a node with no reachable
86
- // notifyPublicUrl to stream these back over a socket instead.
61
+ // Both drained by pollJob β€” the primary has no socket back to this node.
87
62
  rrwebBatches: [],
88
63
  exitCode: null,
89
64
  startedAt: Date.now(),
@@ -112,23 +87,17 @@ function startJob({
112
87
 
113
88
  const ssPoller = startRRwebPoller(ssDir, (batch) => {
114
89
  jobs[jobId].rrwebBatches.push(batch);
115
- primaryStream?.emit('rrweb-batch', batch);
116
90
  });
117
91
 
118
92
  const proc = spawn('npm', ['run', 'test'], { env, shell: true, cwd: BACKEND_DIR });
119
93
  proc.stdout.on('data', (d) => {
120
- const text = d.toString();
121
- jobs[jobId].logs += text;
122
- primaryStream?.emit('log', text);
94
+ jobs[jobId].logs += d.toString();
123
95
  });
124
96
  proc.stderr.on('data', (d) => {
125
- const text = d.toString();
126
- jobs[jobId].logs += text;
127
- primaryStream?.emit('log', text);
97
+ jobs[jobId].logs += d.toString();
128
98
  });
129
99
  proc.on('close', (code) => {
130
100
  ssPoller.stop();
131
- primaryStream?.close();
132
101
  jobs[jobId].status = code === 0 ? JOB_STATUS.DONE : JOB_STATUS.ERROR;
133
102
  jobs[jobId].exitCode = code;
134
103
 
@@ -11,8 +11,6 @@ const { BUILT_IN_RUNNER_ID } = require('../constants/triggers');
11
11
  const { DEFAULT_BROWSER } = require('../constants/defaults');
12
12
  const { bearerHeader } = require('../lib/authHeader');
13
13
  const { JOB_STATUS } = require('../constants/jobStatus');
14
- const settingsService = require('./settingsService');
15
- const nodeStreamRegistry = require('./nodeStreamRegistry');
16
14
 
17
15
  // ---------------------------------------------------------------------------
18
16
  // Runner CRUD
@@ -209,7 +207,6 @@ async function dispatchAndPoll(
209
207
  const finish = (code, content) => {
210
208
  if (settled) return;
211
209
  settled = true;
212
- if (jobId) nodeStreamRegistry.unregisterRelay(jobId);
213
210
  onDone(code, content);
214
211
  };
215
212
 
@@ -220,12 +217,6 @@ async function dispatchAndPoll(
220
217
  return;
221
218
  }
222
219
 
223
- // The node needs to know where to open its own socket back to us β€” without
224
- // this it has no way to reach the primary, since today only the reverse
225
- // (primary knowing each node's url) is configured.
226
- const { notifyPublicUrl } = await settingsService.getWebhooks();
227
- const primaryUrl = notifyPublicUrl ? notifyPublicUrl.replace(/\/$/, '') : null;
228
-
229
220
  let jobId;
230
221
  try {
231
222
  const res = await fetch(`${runner.url}/api/execute`, {
@@ -239,8 +230,7 @@ async function dispatchAndPoll(
239
230
  browser,
240
231
  workers,
241
232
  tests: collectTestFiles(),
242
- env: loadTestEnv(process.cwd()),
243
- ...(primaryUrl ? { primaryUrl } : {})
233
+ env: loadTestEnv(process.cwd())
244
234
  }),
245
235
  signal: AbortSignal.timeout(10000)
246
236
  });
@@ -254,15 +244,11 @@ async function dispatchAndPoll(
254
244
 
255
245
  onLog(`Connected to runner "${runner.name}" β€” job ${jobId}\n`);
256
246
 
257
- // With a primaryUrl configured, the node streams logs/rrweb events over its
258
- // own socket instead β€” draining them from the poll too would duplicate them.
259
- if (primaryUrl) {
260
- nodeStreamRegistry.registerRelay(jobId, { onRRwebBatch, onLog });
261
- }
262
-
263
247
  let logOffset = 0;
264
248
  let rrwebOffset = 0;
265
249
  let polling = false;
250
+ // Tight interval: the live viewer reads logs and rrweb batches straight off
251
+ // this poll — primary→node, so nothing has to connect the other way.
266
252
  const poll = setInterval(async () => {
267
253
  if (polling) return;
268
254
  polling = true;
@@ -277,15 +263,12 @@ async function dispatchAndPoll(
277
263
  if (!res.ok) return;
278
264
  const body = await res.json();
279
265
 
280
- // Skip if a socket relay is active β€” it already pushed these live.
281
- if (!primaryUrl) {
282
- if (body.logs) {
283
- onLog(body.logs);
284
- logOffset += body.logs.length;
285
- }
286
- for (const batch of body.rrwebBatches ?? []) onRRwebBatch?.(batch);
287
- rrwebOffset += body.rrwebBatches?.length ?? 0;
266
+ if (body.logs) {
267
+ onLog(body.logs);
268
+ logOffset += body.logs.length;
288
269
  }
270
+ for (const batch of body.rrwebBatches ?? []) onRRwebBatch?.(batch);
271
+ rrwebOffset += body.rrwebBatches?.length ?? 0;
289
272
 
290
273
  if (body.status === JOB_STATUS.DONE || body.status === JOB_STATUS.ERROR) {
291
274
  clearInterval(poll);
@@ -297,7 +280,7 @@ async function dispatchAndPoll(
297
280
  } finally {
298
281
  polling = false;
299
282
  }
300
- }, 2500);
283
+ }, 1000);
301
284
  }
302
285
 
303
286
  module.exports = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plum-e2e",
3
- "version": "2.9.7",
3
+ "version": "2.9.8",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/silverlunah/plum.git"
@@ -1,24 +0,0 @@
1
- /*
2
- * This file is part of Plum.
3
- * Licensed under the MIT License. See LICENSE file in the project root for details.
4
- */
5
-
6
- // In-memory jobId -> relay callbacks, so an incoming node socket (which only
7
- // knows its own jobId) can find where to forward live rrweb/log events β€”
8
- // registered by whichever dispatch call (socketHandler, cronService) started
9
- // this job and already knows the browser-facing emit target/laneId.
10
- const relays = new Map();
11
-
12
- function registerRelay(jobId, { onRRwebBatch, onLog }) {
13
- relays.set(jobId, { onRRwebBatch, onLog });
14
- }
15
-
16
- function unregisterRelay(jobId) {
17
- relays.delete(jobId);
18
- }
19
-
20
- function getRelay(jobId) {
21
- return relays.get(jobId);
22
- }
23
-
24
- module.exports = { registerRelay, unregisterRelay, getRelay };
@@ -1,40 +0,0 @@
1
- /*
2
- * This file is part of Plum.
3
- * Licensed under the MIT License. See LICENSE file in the project root for details.
4
- */
5
-
6
- const runnerService = require('../services/runnerService');
7
- const nodeStreamRegistry = require('../services/nodeStreamRegistry');
8
-
9
- // A separate namespace from the browser-facing default one β€” a node connects
10
- // with its own runner token (the same credential it already uses to call back
11
- // into the primary's HTTP control routes, see runnerService.isValidToken) and
12
- // announces the jobId it's streaming for, which nodeStreamRegistry maps back
13
- // to whichever dispatch call is waiting on it.
14
- function nodeSocketHandler(io) {
15
- const nodeIo = io.of('/node-stream');
16
-
17
- nodeIo.use(async (socket, next) => {
18
- const token = socket.handshake.auth?.token;
19
- if (await runnerService.isValidToken(token)) return next();
20
- next(new Error('unauthorized'));
21
- });
22
-
23
- nodeIo.on('connection', (socket) => {
24
- let jobId = null;
25
-
26
- socket.on('join', (id) => {
27
- jobId = id;
28
- });
29
-
30
- socket.on('rrweb-batch', (batch) => {
31
- if (jobId) nodeStreamRegistry.getRelay(jobId)?.onRRwebBatch?.(batch);
32
- });
33
-
34
- socket.on('log', (text) => {
35
- if (jobId) nodeStreamRegistry.getRelay(jobId)?.onLog?.(text);
36
- });
37
- });
38
- }
39
-
40
- module.exports = nodeSocketHandler;