我正在使用 Pusher Javascript library创建一个实时网络应用程序。一切都像一个魅力,但是当我设置 cluster
eu
的参数(我的用户将仅从法国连接),我得到一个错误。
这是我使用的代码:
var pusher = new Pusher('<thisismykey>', {
encrypted: true,
authEndpoint: '{{ baseUrl() }}/pusher_auth',
cluster: 'eu' // This
});
这是我得到的错误:
{
"type": "WebSocketError",
"error": {
"type": "PusherError",
"data": {
"code": 4001,
"message": "Could not find app by key <thisismykey>. Perhaps you're connecting to the wrong cluster."
}
}
}
我可以使用这个参数吗?或者在我的 Pusher 仪表板中有什么要做的吗? Pusher 文档对此不是很清楚。
最佳答案
恕我直言,接受的答案没有多大帮助。
就我而言,我对 PUSHER_KEY
和 PUSHER_APP_ID
感到困惑。
因此我的代码是(在 .erb
中):
pusher = new Pusher('<%=ENV['PUSHER_KEY']%>',
cluster: 'eu',
encrypted: true,
authEndpoint: '/notifications/auth'
)
关于javascript - 将 Pusher 集群设置为 'eu' 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29984114/