Answer the question
In order to leave comments, you need to log in
Node JS + Socket.io How to get specific cookie value?
I'm trying to get a specific cookie value for authorization.
io.configure(function (){
io.set('authorization', function (handshakeData, callback) {
var cook = handshakeData.headers.cookie;
console.log(cook);
callback(null, true); // error first callback style
});
});
Answer the question
In order to leave comments, you need to log in
Maybe this will help you.
The fact is that there can be several cookies in the header, so you get a string or an array.
In order to get a specific cookie, you need to parse the answer and then take the right one. The link above has it all.
Something like this...
io.configure(function (){
io.set('authorization', function (handshakeData, callback) {
var cookies = parseCookies(handshakeData);
console.log(cookies);
callback(null, true); // error first callback style
});
});
function parseCookies(request) {
var list = {},
rc = request.headers.cookie;
rc && rc.split(';').forEach(function(cookie) {
var parts = cookie.split('=');
list[parts.shift().trim()] = unescape(parts.join('='));
});
return list;
}
It's not a font.
Life hack: if you need vector logos of some factories or combines and you can't find them on sites with vectors, then look at their site in sections like "press about us" or their PDF editions.
In 80% of cases you will find a vector logo in its normal form. As a rule, even requests to the press service "send a vector, at least corel" do not give a result.
In this case, this is the symbolism of the former RAO UES. Search there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question