我使用node.js和ws模块连接到某个网站的websocket,这通常可以正常工作,但最近他们正在更新某些内容而不是启用cloudflare保护......
所以我在尝试连接时得到503服务器响应
function connect_to_ws(failures) {
if (already_connected) return;
if (failures == undefined) failures = 0;
log('Connecting to "' + ws_server + '"...');
var ws = new WebSocket(ws_server, [], {
'headers': {
'Cookie': cookie
}
});
ws.on('open', function() {
already_connected = true;
log('Connected');
});
...