[英]Websocket Cookie
I'm just new to websocket, I don't know how to access to these cookie in websocket request header. 我只是websocket的新手,我不知道如何在websocket请求标头中访问这些cookie。 It doesn't have domain or path.
它没有域或路径。 Is there any way to use javascript to read or re-rewrite these cookie?
有没有办法使用javascript读取或重写这些cookie?
Websocket request looks like HTTP, but it's not. Websocket请求看起来像HTTP,但不是。 So, cookie header is not available.
因此,cookie标头不可用。 As a workaround, you may send cookie after a handshake.
解决方法是,您可以在握手后发送cookie。 Something like:
就像是:
var ws = new Websocket(...);
ws.onopen = function(e) {
ws.send(document.cookie);
}
And pick up the cookie on server side. 并在服务器端获取cookie。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.