Can I access a cookie from Socket.io?

前端 未结 4 1787
孤街浪徒
孤街浪徒 2020-12-05 12:55

I want to set some user information in a cookie and be able to access it on connection, is this possible?

4条回答
  •  温柔的废话
    2020-12-05 13:36

    client.request.headers.cookie leads to race conditions as the cookie always points to the last logged in user.

    Please see: Socket.IO Authentication.

提交回复
热议问题