简体   繁体   中英

How to set cookie in request header for websocket in Javascript?

I'm using Angular2 and my backend authenticate the websocket request using Cookie in the request header. I have created a cookie but it does not appear in the header of the websocket request.

Here it is an example of what I will need to have.

在此输入图像描述

For now I do not see the cookie while it is set.

在此输入图像描述

I used this example to create the angular2 service : https://tutorialedge.net/angular-2-websockets-tutorial

Thanks!

这些请求是针对两个不同的主机, http://localhost:3000teamcall.the-patriots.com ,因此来自第一个的cookie不会被发送到第二个。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM