Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

socketcluster-server + sc-broker-cluster #37

Open
fas3r opened this issue Mar 13, 2019 · 3 comments
Open

socketcluster-server + sc-broker-cluster #37

fas3r opened this issue Mar 13, 2019 · 3 comments

Comments

@fas3r
Copy link

fas3r commented Mar 13, 2019

Hello,

Could it be possible to get some information or guidance on how to implement the sc-broker-cluster with the socketcluster-server ?

When I set the brokerEngine to 'sc-broker-cluster' in the options I'm getting the following error :

/tmp/scc/app/node_modules/socketcluster-server/scserver.js:101
  this.brokerEngine.once('ready', function () {
                    ^
TypeError: this.brokerEngine.once is not a function
    at new SCServer (/tmp/scc/app/node_modules/socketcluster-server/scserver.js:101:21)
    at Object.module.exports.attach (/tmp/scc/app/node_modules/socketcluster-server/index.js:65:29)
    at Object.<anonymous> (/tmp/scc/app/server:15:36)
    at Module._compile (internal/modules/cjs/loader.js:702:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)
    at startup (internal/bootstrap/node.js:240:19)```


Thanks !
@vladilsav10
Copy link

Hi,

I also get this error. Looking /scserver.js, it seems that the server does not try to require the broker from the string. Instead it seems to expect an instance to be handed over.

I tried passing new require('sc-broker-cluster'').Client(), which gave me a new error:

TypeError: Cannot read property 'brokers' of undefined
    at new module.exports.Client (/home/user/NodeJS/project/node_modules/sc-broker-cluster/index.js:438:25)

I do appreciate that the developers made a ready to go framework which handles this issue for you, but what I like about NodeJS is the flexibility of it`s modules. If it is possible, I do want to manage the processes on my own, even though this will lead to more work.

I also looked into the socketcluster source code, but it was a bit hard to understand the whole process. Heck, I don't think I even found where multiple brokers are created. Once I have more time, I might give it another go, but for now, a minimal tutorial would be nice.

@x-077
Copy link

x-077 commented Apr 2, 2019

Look at the scc-cluster-broker

@vladilsav10
Copy link

Hi @matth-c3 , do you mean sc-broker-cluster?

I did, but I'm still not sure how to properly do it.

From my understanding, you run the sc-cluster-broker.Server on a separate process and then pass the sc-cluster-broker.Client to the socketcluster-server, but I don''t quite understand the details behind it yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants