workerman作为ws客户端,如何设置额外的header?

$header = "Cookie: cId=26628661780583\r\n";
$header .= "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36\r\n";


$option = [
'http' => [
'header' => $header,
],
];

$con = new AsyncTcpConnection('ws://www.test.com:9000/socket.io', $option);

[b]这样设置没有效果,请问应该如何设置?[/b]
已邀请:

顾涛 - 90后

赞同来自: wenken

找到了,在这里
https://github.com/walkor/Workerman/pull/374

wenken

赞同来自:

$header = [
"Cookie: cId=26628661780583",
"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"
];


$option = [
'http' => [
'header' => $header,
],
];

$con = new AsyncTcpConnection('ws://www.test.com:9000/socket.io', $option);
[code]这样试试!

要回复问题请先登录注册