我正在使用 Angular2,我的后端使用请求 header 中的 Cookie 来验证 Websocket 请求。 我创建了一个 cookie,但它没有出现在 websocket 请求的 header 中。
这是我需要的一个示例。
目前,我在设置 cookie 时看不到它。
我使用此示例创建了 angular2 服务:https://tutorialedge.net/angular-2-websockets-tutorial
谢谢!
最佳答案
这些请求是针对两个不同的主机,http://localhost:3000
和 teamcall.the-patriots.com
,因此第一个的 cookie 无效。不会被发送到第二个。
关于javascript - 如何在Javascript中的websocket请求 header 中设置cookie?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42889584/