N
N
Nwton2017-01-18 02:51:01
Node.js
Nwton, 2017-01-18 02:51:01

How to get new cookies in socket io?

After the connection, I get the user's cookies like this:
cookie = socket.handshake.headers.cookie;
But there is a problem. If during an active connection a new cookie is set on the client or the old one is changed, then I will not see this in socket.handshake.headers.cookie.
How to re-obtain socket.handshake.headers during connection and get new cookies?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
catHD, 2017-01-18
@catHD

Изменение куки инициируются сервером? Создайте отдельный метод "отправки" куки и дергайте после изменения.
НО! давать клиенту доступ к куки на клиентской стороне - плохая идея.

A
Alexander Bublikov, 2017-01-23
@bublik462

Create an event on the client, if the cookie changes, then the value of this cookie is sent to the server.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question