NotImplementedError(仅支持部分劫持。)使用message_bus

时间:2016-04-11 14:48:51

标签: ruby-on-rails ruby-on-rails-4 message-bus

我只是将gem添加到gemfile并写入js控制台:

 MessageBus.subscribe('/my_channel', function(data){
   alert(data);
 });
它扔了:

Started POST "/message-bus/4700f3c66b254e31875de6caeba011df/poll" for 127.0.0.1 at 2016-04-11 11:32:49 -0300
** [Airbrake] Notice was not sent due to configuration:         
  Environment Monitored? false         
  API key set? false

NotImplementedError (only partial hijack is supported.):
  rack (1.6.4) lib/rack/handler/webrick.rb:76:in `block in service'
  /home/alter/.rvm/gems/ruby-2.2.2@project/bundler/gems/message_bus-7a93b755b456/lib/message_bus/rack/middleware.rb:141:in `call'
  /home/alter/.rvm/gems/ruby-2.2.2@project/bundler/gems/message_bus-7a93b755b456/lib/message_bus/rack/middleware.rb:141:in `call'
  rack (1.6.4) lib/rack/session/abstract/id.rb:225:in `context'
  rack (1.6.4) lib/rack/session/abstract/id.rb:220:in `call'
  actionpack (4.2.1) lib/action_dispatch/middleware/cookies.rb:560:in `call'
  activerecord (4.2.1) lib/active_record/query_cache.rb:36:in `call'
  activerecord (4.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:649:in `call'
  activerecord (4.2.1) lib/active_record/migration.rb:378:in `call'
  actionpack (4.2.1) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
  activesupport (4.2.1) lib/active_support/callbacks.rb:88:in `call'
  activesupport (4.2.1) lib/active_support/callbacks.rb:88:in `_run_callbacks'
  activesupport (4.2.1) lib/active_support/callbacks.rb:776:in `_run_call_callbacks'
  activesupport (4.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (4.2.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (4.2.1) lib/action_dispatch/middleware/reloader.rb:73:in `call'
  actionpack (4.2.1) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
  airbrake (4.3.6) lib/airbrake/rails/middleware.rb:13:in `call'
  actionpack (4.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
  web-console (2.3.0) lib/web_console/middleware.rb:28:in `block in call'
  web-console (2.3.0) lib/web_console/middleware.rb:18:in `catch'
  web-console (2.3.0) lib/web_console/middleware.rb:18:in `call'
  actionpack (4.2.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.2.1) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.2.1) lib/rails/rack/logger.rb:20:in `block in call'
  activesupport (4.2.1) lib/active_support/tagged_logging.rb:68:in `block in tagged'
  activesupport (4.2.1) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (4.2.1) lib/active_support/tagged_logging.rb:68:in `tagged'
  railties (4.2.1) lib/rails/rack/logger.rb:20:in `call'
  quiet_assets (1.1.0) lib/quiet_assets.rb:27:in `call_with_quiet_assets'
  request_store (1.3.0) lib/request_store/middleware.rb:9:in `call'
  actionpack (4.2.1) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
  rack (1.6.4) lib/rack/runtime.rb:18:in `call'
  activesupport (4.2.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
  rack (1.6.4) lib/rack/lock.rb:17:in `call'
  actionpack (4.2.1) lib/action_dispatch/middleware/static.rb:113:in `call'
  rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
  airbrake (4.3.6) lib/airbrake/user_informer.rb:16:in `_call'
  airbrake (4.3.6) lib/airbrake/user_informer.rb:12:in `call'
  railties (4.2.1) lib/rails/engine.rb:518:in `call'
  railties (4.2.1) lib/rails/application.rb:164:in `call'
  rack (1.6.4) lib/rack/lock.rb:17:in `call'
  rack (1.6.4) lib/rack/content_length.rb:15:in `call'
  rack (1.6.4) lib/rack/handler/webrick.rb:88:in `service'
  /home/alter/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
  /home/alter/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
  /home/alter/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'


  Rendered /home/alter/.rvm/gems/ruby-2.2.2@project/gems/actionpack-4.2.1/lib/action_dispatch/middleware/templates/rescues/_source.erb (1.5ms)
  Rendered /home/alter/.rvm/gems/ruby-2.2.2@project/gems/actionpack-4.2.1/lib/action_dispatch/middleware/templates/rescues/_trace.text.erb (0.4ms)
  Rendered /home/alter/.rvm/gems/ruby-2.2.2@project/gems/actionpack-4.2.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.text.erb (0.6ms)
  Rendered /home/alter/.rvm/gems/ruby-2.2.2@project/gems/actionpack-4.2.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.text.erb (14.4ms)

我基于这个主人:

GIT
  remote: git://github.com/SamSaffron/message_bus.git
  revision: 7a93b755b4568becb3ef87ed8053aa3e4c5346a4
  branch: master
  specs:
    message_bus (2.0.0.beta.6)
      rack (>= 1.1.3)

1 个答案:

答案 0 :(得分:13)

我在本地使用webrick。我只需将gem 'puma'添加到Gemfile的group :development即可解决问题。