尝试使用操作电缆广播Web通知时出错

时间:2019-08-12 06:34:12

标签: ruby-on-rails http actioncable

当我尝试使用操作电缆广播Web通知时,我在Rails服务器终端中遇到以下错误

rails s
=> Booting Puma
=> Rails 5.2.3 application starting in development 
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.12.1 (ruby 2.5.1-p57), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3000
Use Ctrl-C to stop
Started GET "/" for 127.0.0.1 at 2019-08-12 11:40:16 +0530
Processing by PageController#index as HTML
  Rendering page/index.html.erb within layouts/application
  Rendered page/index.html.erb within layouts/application (2.0ms)
Completed 200 OK in 17ms (Views: 11.6ms | ActiveRecord: 0.0ms)

2019-08-12 11:40:24 +0530: HTTP parse error, malformed request (): #<Puma::HttpParserError: Invalid HTTP format, parsing fails.>

以及Rails控制台终端中的以下错误

rails c
Running via Spring preloader in process 70237
/.rvm/gems/ruby-2.5.1/gems/spring-2.1.0/lib/spring/application.rb:199: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
Loading development environment (Rails 5.2.3)
2.5.1 :001 > ActionCable.server.broadcast 'web_notifications_channel', message: '<p>Hello World </p>'
[ActionCable] Broadcasting to web_notifications_channel: {:message=>"<p>Hello World </p>"}
Traceback (most recent call last):
        1: from (irb):1
Redis::ProtocolError ( Got 'H' as initial reply byte. If you're in a forking environment, such as Unicorn, you need to connect to Redis after forking. )

1 个答案:

答案 0 :(得分:0)

我已找到此错误的原因, I didn't specify the correct port