Pusher JS is not working from node JS in some network

跟風遠走 提交于 2019-12-11 07:24:23

问题


I followed the guide of Pusher docs to create a simple example, and the code is copy from the Code examples.

This example works well when I'm at home, but it's never working when I'm in office.

In office, the HTML page can alert the message when I use the Debug Console provided by Pusher to create new Event. However, the HTML page won't alert any messages when I trigger the event from node JS.

I guess the problem is related to the network, so I want to know how to jump over the network limitation while using pusher js from node js.


回答1:


var pusher = new Pusher({ // you can set other options in any of the 3 ways described above
  proxy: 'HTTP_PROXY_URL', // optional, URL to proxy the requests through
  timeout: TIMEOUT, // optional, timeout for all requests in milliseconds
  keepAlive: KEEP_ALIVE // optional, enables keep-alive, defaults to false
});

The issue has been solved, it indeed is the network matters, and just set the proxy, then it works.



来源:https://stackoverflow.com/questions/26707546/pusher-js-is-not-working-from-node-js-in-some-network

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!