Chan Yoong Hon
Chan Yoong Hon

Reputation: 1812

Pusher with nodejs not work under proxy network

I follow guide from Pusher JS is not working from node JS in some network to set proxy in my code. However, it shows error in my terminal.

error

The following is my code to add proxy server.

  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
    });

Upvotes: 0

Views: 363

Answers (1)

benjaminbenben
benjaminbenben

Reputation: 1228

The problem is that the variable TIMEOUT hasn't been set anywhere (you'll have the same issue with KEEP_ALIVE too). You've got a couple of options to resolve this:

1) set the timeout and keepAlive

//...
proxy: 'http://username:password@proxynework:ppr\#',
timeout: 2000,
keepAlive: false

2) leave them out (they're optional)

  // ...
  proxy: 'http://username:password@proxynework:ppr\#'
  // use default timeout and keepalive values
});

Upvotes: 2

Related Questions