[英]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. 我正在使用Angular2,我的后端使用请求标头中的Cookie验证websocket请求。 I have created a cookie but it does not appear in the header of the websocket request.
我创建了一个cookie但它没有出现在websocket请求的标题中。
Here it is an example of what I will need to have. 这是我需要拥有的一个例子。
For now I do not see the cookie while it is set. 现在我在设置时没有看到cookie。
I used this example to create the angular2 service : https://tutorialedge.net/angular-2-websockets-tutorial 我用这个例子来创建angular2服务: https ://tutorialedge.net/angular-2-websockets-tutorial
Thanks! 谢谢!
这些请求是针对两个不同的主机, http://localhost:3000
和teamcall.the-patriots.com
,因此来自第一个的cookie不会被发送到第二个。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.