【发布时间】:2011-05-17 16:57:06
【问题描述】:
在与 socket.io 握手 WebSocket 连接时,有没有一种方法可以轻松传递身份验证 cookie?我目前必须分开做,像这样:
socket = new io.Socket(document.location.hostname);
socket.addEvent("connect", function()
{
// Send PHP session ID, which will be used to authenticate
var sessid = readCookie("PHPSESSID");
this.send("{'action':'authenticate','sessionid':'"+sessid+"'}");
});
【问题讨论】: