如果启用了cloudflare保护,则连接到websocket

时间:2017-11-02 13:04:31

标签: node.js websocket cloudflare

我使用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');
});
...

0 个答案:

没有答案