Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/459.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 推动者:“是的。”;未捕获类型错误:无法调用方法';范围为';“未定义”的定义;创作时_Javascript_Ruby_Pusher - Fatal编程技术网

Javascript 推动者:“是的。”;未捕获类型错误:无法调用方法';范围为';“未定义”的定义;创作时

Javascript 推动者:“是的。”;未捕获类型错误:无法调用方法';范围为';“未定义”的定义;创作时,javascript,ruby,pusher,Javascript,Ruby,Pusher,我的应用程序控制器中有我的应用程序密钥、密钥和密码 我的推送控制器: def auth if current_user auth = Pusher[params[:channel_name]].authenticate(params[:socket_id], :user_id => current_user.id, # => required :user_info => { # => optional

我的应用程序控制器中有我的应用程序密钥、密钥和密码

我的推送控制器:

  def auth
    if current_user
      auth = Pusher[params[:channel_name]].authenticate(params[:socket_id],
        :user_id => current_user.id, # => required
        :user_info => { # => optional
          :name => current_user.name,
          :email => current_user.email
        }
      )
      render :json => auth
    else
      render :text => "Not authorized", :status => '403'
    end
  end
我的js

我很确定我是按照这些线索做的

我只是不明白为什么会出现这个错误

this is the error :
Uncaught TypeError: Cannot call method 'scopedTo' of undefined
Pusher.Channel.PrivateChannel.authorizepusher.min.js:38
Pusher.subscribepusher.min.js:13
Pusher.subscribeAllpusher.min.js:12
connection.bind.bind.cpusher.min.js:10
a.emitpusher.min.js:17
jpusher.min.js:25
_machine.b.Machine.connectedPostpusher.min.js:29
apusher.min.js:19
c.transitionpusher.min.js:20
w
此资源看起来已过期-我们需要将其删除

您应该使用最新版本的Pusher JavaScript库,您可以在这里找到:


以及中所述的以下身份验证。您的服务器代码看起来不错。错误发生在您的客户端上,我希望更新JavaScript库能够解决此问题-我们尚未收到有关此问题的任何支持请求。

删除这两行:

Pusher.channel_auth_endpoint = "/pusher/auth";
Pusher.channel_auth_transport = 'json';

我将再次查看文档,但我/正在/使用pusher=\n的版本,这是因为我有:pusher.channel\u auth\u transport='json';因此,删除它,修复了问题!这是有意义的。没有
json
身份验证传输。有效的传输是
ajax
jsonp
jsonp
可用于跨域身份验证。
Pusher.channel_auth_endpoint = "/pusher/auth";
Pusher.channel_auth_transport = 'json';