AdonisJS with WebSocket cluster #3789
Unanswered
programmerLifes
asked this question in
Help
Replies: 2 comments
-
The official WebSocket package from v4 hasn't been migrated yet. There is a cookbook explaining how to use socket.io as an alternative in the meantime. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Apparently this doesn't work when developing on local environment. I get an error of: [ info ] re-starting http server...
TypeError
Cannot read properties of undefined (reading 'id')
at new ClusterAdapter <path>/node_modules/@socket.io/cluster-adapter/dist/index.js:60
55| this.requests = new Map();
56| this.ackRequests = new Map();
57| this.requestsTimeout = opts.requestsTimeout || 5000;
58| this.publish({
59| type: EventType.WORKER_INIT,
❯ 60| data: cluster.worker.id,
61| });
62| process.on("message", this.onMessage.bind(this));
63| }
64| async onMessage(message) {
65| const isValidSource = (message === null || message === void 0 ? void 0 : message.source) === MESSAGE_SOURCE;
1 new <anonymous>
<path>/node_modules/@socket.io/cluster-adapter/dist/index.js:39
2 Namespace._initAdapter
<path>/node_modules/socket.io/dist/namespace.js:40
3 Server.adapter
<path>/node_modules/socket.io/dist/index.js:136
4 Ws.boot
<path>/app/Services/Ws.ts:24
5 Object.<anonymous>
<path>/start/socket.ts:4
6 Module._compile
<path>/node_modules/pirates/lib/index.js:136
7 Object.newLoader [as .ts]
<path>/node_modules/pirates/lib/index.js:141 EDIT: I just learned that the configuration on my side is different and using clusters. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I was using the legacy website from adonis and i saw the webSocket provider has not been migrated yet to the new website but is it compatible with adonis 5 and just didnt migrate to website or isnt compatible with adonis 5?
Beta Was this translation helpful? Give feedback.
All reactions