Socket.io, express and sticky sessions. How to...

1,462 views
Skip to first unread message

Kevin Ingwersen (Ingwie Phoenix)

unread,
Apr 16, 2015, 9:15:35 AM4/16/15
to nod...@googlegroups.com
Hey everyone.

If you peered into the list, you may saw that I was asking for help ins caling my app. And I got that one working just as I wanted; using „various-cluster“ for a pretty neat way to spawn multiple workers of specific scripts. That one is pretty neat. I use a Frontent-Worker that only does what it osund slike; managing stuff for the frontend, my HTTP server, for instance. Hooooowever… socket.io requires ~3 requests for a handshake. I am assuming that the first is to get a session, the second is to negotiate a transport and the third is to actually „connect“.

But if request 1 and 2 are handled on different servers, socket.io fails in it’s error handling for good. Although the server sends back a crisp clear error message, socket.io attempts to re-connect instead of letting a developer know of the mandatory issue.

So, I went to read. Socket.io recommends http://npmjs.com/sticky-session … boy is that thing outdated, at least it feels that way. It had no example for Express, and my guts told me that if it had one, it would be for Express 3 instead of 4, which I use.

Further research brought up the issue #7, which refers to Express not behaving with sticky-session … cool, really. I totally jumped in joy. :(
To make things worse; it’s not resolved. I tested it and it didn’t work.

Does any one of you know of a way to enable sticky sessions when already being in a worker? various-cluster already spawns my frontent_worker.js in a worker process, so cluster.isMaster should be false in any case…at least I’d think so.

So if anyone has an idea for this, then please let me know. Thanks!

Kind regards,
Ingwie

Guillermo Rauch

unread,
Apr 16, 2015, 1:53:13 PM4/16/15
to nod...@googlegroups.com
Check out:

for up-to-date information on the topic.

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/8DEF5947-1620-4F5D-804B-301D249AE34F%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages