ActionCable连续连接/断开循环

van*_*oom 6 ruby-on-rails-4 actioncable

我的rails应用程序正在使用ActionCable gem,配置为具有一个通道的简单聊天应用程序.

关闭事件不断被调用,然后不断重新打开.我的Rails服务器正在正确地看到连接; 循环发生在浏览器/ Javascript中.

 Connection.prototype.events = {
      message: function(event) {
        var identifier, message, ref;
        ref = JSON.parse(event.data), identifier = ref.identifier, message = ref.message;
        return this.consumer.subscriptions.notify(identifier, "received", message);
      },
      open: function() {
        this.disconnected = false;
        return this.consumer.subscriptions.reload();
      },
      close: function() {
        return this.disconnect();
      },
      error: function() {
        return this.disconnect();
      }
    };
Run Code Online (Sandbox Code Playgroud)

有没有人遇到过这个问题?

小智 1

确保您使用的是瘦服务器以外的服务器。我遇到了这个问题,用头撞键盘三天,直到尝试不同的服务器(puma)并能够解决我的问题。 https://github.com/puma/puma