socket.io icon indicating copy to clipboard operation
socket.io copied to clipboard

Passing cookies during handshake

Open ggrav opened this issue 12 years ago • 6 comments

My deployment environment provides sticky connection via a Cookie parameter which is got when the first get request is made to the server. The subsequent request needs to pass the cookie for providing the sticky connection.

I verified that The cookies are getting passed correctly when running the client in the browser. However, the cookie information is not coming to the server , if I run the client code as a node.exe process

Below is my stripped down version of the client code. Any idea on how I can pass the cookie information ?

var io = require("socket.io-client");

var socket = io.connect(http://bubble.trafficmanager.net/, { 'force new connection' : true });

socket.on('connect', function () { });

ggrav avatar Oct 24 '14 14:10 ggrav

hi - Any pointers will be really helpful

ggrav avatar Oct 30 '14 02:10 ggrav

You mean pass cookie from one nodejs process (client) to another (server) during socket.io handshake ?

klimashkin avatar Nov 05 '14 20:11 klimashkin

It's quite troublesome to use cookies from a nodejs proces. I ended up using a url parameter, see: https://github.com/Automattic/socket.io-client/issues/775

peteruithoven avatar Nov 05 '14 21:11 peteruithoven

klimashkin - yes , this is from the client to another server. I am trying to build an IPhone app using SIOSocket. the issue happens there as well..

peteruithoven - I am using azure websites as the platform where sticky session is supported by the platform. I do not control it. I will have to move to cloud service and implement my own ARR - If there is no way to do it, I will have to explore this :(

ggrav avatar Nov 06 '14 15:11 ggrav

What's ARR? Maybe you can investigate whether Azure supports url parameters or ip based sticky sessions?

peteruithoven avatar Nov 06 '14 15:11 peteruithoven

That issue was closed automatically. Please check if your issue is fixed with the latest release, and reopen if needed (with a fiddle reproducing the issue if possible).

darrachequesne avatar Jan 12 '17 15:01 darrachequesne