SocketCluster / SocketCluster/socketcluster

SCC Guide - Unable or unsure to run on multiple machines

Open
#519 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
6.2k
Forks
318
PR merge metrics
No merged PRs in 30d

Description

This is wonderful work and I'm very grateful to find this repo. I'm having difficulty understanding how to scale to multiple networks following the SCC guide and also confused on the recommended architecture. The main issue is clients on separate servers are not finding messages from each other.

On a gcloud instance, i start the state (node server.js), broker( SCC_STATE_SERVER_HOST='[google given ip]' SCC_BROKER_SERVER_PORT='8888' node server ), and ( SCC_STATE_SERVER_HOST='[google given ip]' SOCKETCLUSTER_PORT='8000' node server ) client servers. Everything works and I can access the google given ip from anywhere.

On my localhost I start broker and client servers with the same commands with the google ips. The state server registers the brokers and workers on both machines:

Waiting 5000ms for initial scc-broker instances before allowing scc-worker instances to join
The scc-state instance is listening on port 7777
State server is now allowing scc-worker instances to join the cluster
The scc-broker instance 45a77768-c686-49f6-b79f-51b43d463822 at address ::ffff:35.223.156.17 on port 8888 joined the cluster on socket qlcAdjbw6tXq6fp0AAAA
The scc-worker instance 1b75cc5e-8931-46ed-ab73-5aae6214e952 at address ::ffff:35.223.156.17 on port 8000 joined the cluster on socket errAsDdh9SCCHSqYAAAB
The scc-broker instance 2c1d4737-6ede-4e48-b4ec-bea4cbc9c416 at address ::ffff:185.168.226.254 on port 8888 joined the cluster on socket KwjMvKfKUR2VNfFEAAAC
The scc-worker instance 2327d3c0-7942-476e-a75a-f69857944c14 at address ::ffff:178.134.28.18 on port 8000 joined the cluster on socket 2XZowZwuxkibGol_AAAD

The client server on the google ip reacts to emitting a message from the browser connecting to the google IP but the local client server does not react to emitting a message from the localhost browser connection. Both client servers are throwing:

{ SocketProtocolError: Client connection establishment timed out
    at SCClientSocket._onSCClose (/Users/34r7h/apps/xymba/node_modules/socketcluster-client/lib/scclientsocket.js:632:15)
    at SCTransport.<anonymous> (/Users/34r7h/apps/xymba/node_modules/socketcluster-client/lib/scclientsocket.js:304:12)
    at SCTransport.Emitter.emit (/Users/34r7h/apps/xymba/node_modules/socketcluster-client/node_modules/component-emitter/index.js:133:20)
    at SCTransport._onClose (/Users/34r7h/apps/xymba/node_modules/socketcluster-client/lib/sctransport.js:217:28)
    at Timeout.<anonymous> (/Users/34r7h/apps/xymba/node_modules/socketcluster-client/lib/sctransport.js:86:10)
    at ontimeout (timers.js:436:11)
    at tryOnTimeout (timers.js:300:5)
    at listOnTimeout (timers.js:263:5)
    at Timer.processTimers (timers.js:223:10)
  name: 'SocketProtocolError',
  message: 'Client connection establishment timed out',
  code: 4007 }

Am I missing something? I made one change to the broker server to use 'ws' since 'sc-uws' was giving compilation errors. Thanks!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the SCC guide and the node server.js startup commands for the state, broker, and client servers, including SCC_STATE_SERVER_HOST, SCC_BROKER_SERVER_PORT, and SOCKETCLUSTER_PORT. Reproduce the separate-machine setup and trace the Client connection establishment timed out error in socketcluster-client/lib/scclientsocket.js; done means explaining or correcting the configuration so both client servers exchange messages.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend, distributed-systems, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.