我按照Pusher JS is not working from node JS in some network的指南在我的代码中设置代理。但是,它在我的终端中显示错误。
以下是我添加代理服务器的代码。
var Pusher = require("pusher");
var pusher = new Pusher({
appId: config.app_id,
key: config.key,
secret: config.secret,
proxy: 'http://username:password@proxynework:ppr\#',
timeout: TIMEOUT,
keepAlive: KEEP_ALIVE
});
答案 0 :(得分:2)
问题是变量TIMEOUT
尚未设置在任何位置(您也会遇到与KEEP_ALIVE
相同的问题)。你有几个选择来解决这个问题:
1)设置超时和keepAlive
//...
proxy: 'http://username:password@proxynework:ppr\#',
timeout: 2000,
keepAlive: false
2)将它们留下(它们是可选的)
// ...
proxy: 'http://username:password@proxynework:ppr\#'
// use default timeout and keepalive values
});