LoginSignup
2
1

More than 5 years have passed since last update.

[Rails] Action CableでWebsocketが繋がらない(原因はconfig)

Last updated at Posted at 2019-04-08

問題

Action CableでWebsocketが繋がらない。
bashには下の様なログがひたすら出続ける。

bash
Started GET "/cable" for 10.0.2.2 at 2019-04-08 08:30:09 +0100
Started GET "/cable/" [WebSocket] for 10.0.2.2 at 2019-04-08 08:30:09 +0100
Successfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: websocket)
RoomChannel is transmitting the subscription confirmation
Started GET "/cable" for 10.0.2.2 at 2019-04-08 08:30:09 +0100
Started GET "/cable/" [WebSocket] for 10.0.2.2 at 2019-04-08 08:30:09 +0100
Successfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: websocket)
RoomChannel is transmitting the subscription confirmation
Started GET "/cable" for 10.0.2.2 at 2019-04-08 08:30:18 +0100
Started GET "/cable/" [WebSocket] for 10.0.2.2 at 2019-04-08 08:30:18 +0100
Successfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: websocket)
RoomChannel is transmitting the subscription confirmation

原因

config/environments/development.rbで以下の設定をしていた事が原因だった。

config/environments/development.rb
config.reload_classes_only_on_change = false

解法

コメントアウトするか削除すればよい。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1