Pusher JS 无法从某些网络中的节点 JS 工作 [英] Pusher JS is not working from node JS in some network

查看:50
本文介绍了Pusher JS 无法从某些网络中的节点 JS 工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照 Pusher 文档的指南创建了一个简单的示例,代码是从代码示例中复制的.

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.

在office中,当我使用Pusher提供的调试控制台创建新事件时,HTML页面可以提示消息.但是,当我从节点 JS 触发事件时,HTML 页面不会提醒任何消息.

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.

我猜这个问题和网络有关,所以我想知道如何在使用node js的pusher 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.

推荐答案

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.

这篇关于Pusher JS 无法从某些网络中的节点 JS 工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆