Ruby on rails 操作电缆直接连接(预期HTTP 101响应,但未找到404';+;未能升级到WebSocket)

Ruby on rails 操作电缆直接连接(预期HTTP 101响应,但未找到404';+;未能升级到WebSocket),ruby-on-rails,ruby-on-rails-5,actioncable,Ruby On Rails,Ruby On Rails 5,Actioncable,我正在尝试打开一个直接的websocket连接到我的动作电缆的路径。不幸的是,这不起作用。我只是在打冰壶或打http://localhost:3000/cable直接 Started GET "/cable" for 127.0.0.1 at 2019-02-06 20:04:08 -0600 Started GET "/cable/"[non-WebSocket] for 127.0.0.1 at 2019-02-06 20:04:08 -0600 Failed to upgrade to W

我正在尝试打开一个直接的websocket连接到我的动作电缆的路径。不幸的是,这不起作用。我只是在打冰壶或打
http://localhost:3000/cable
直接

Started GET "/cable" for 127.0.0.1 at 2019-02-06 20:04:08 -0600
Started GET "/cable/"[non-WebSocket] for 127.0.0.1 at 2019-02-06 20:04:08 -0600
Failed to upgrade to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: keep-alive, HTTP_UPGRADE: )
Finished "/cable/"[non-WebSocket] for 127.0.0.1 at 2019-02-06 20:04:08 -0600
这是我的客户机中的例外情况:

java.net.ProtocolException: Expected HTTP 101 response but was ‘404 Not Found’
但是如果我点击
http://localhost:3000/page/index
通过浏览器,我可以看到以下输出:

Started GET "/page/index" for 127.0.0.1 at 2019-02-06 20:05:30 -0600
Processing by PageController#index as HTML
  Rendering page/index.html.erb within layouts/application
  Rendered page/index.html.erb within layouts/application (0.3ms)
Completed 200 OK in 28ms (Views: 25.5ms | ActiveRecord: 0.0ms)


Started GET "/cable" for 127.0.0.1 at 2019-02-06 20:05:30 -0600
Started GET "/cable/" [WebSocket] for 127.0.0.1 at 2019-02-06 20:05:30 -0600
Successfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: websocket)
  User Load (0.7ms)  SELECT  "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT $1  [["LIMIT", 1]]
  ↳ app/channels/application_cable/connection.rb:12
Registered connection (Z2lkOi8vd2hvcy1yZWFkeS1hcGkvVXNlci8z)
RoomChannel is transmitting the subscription confirmation
RoomChannel is streaming from room_channel
RoomChannel is transmitting the subscription confirmation
RoomChannel is streaming from room_channel
以下是相关文件,如果需要分享更多信息,请告诉我:

#routes.rb
Rails.application.routes.draw do
  mount API::Base, at: '/'

  mount ActionCable.server => '/cable/chat'

  get 'page/index'
  root 'page#index'
end

#page_controller.rb
类PageController<应用程序控制器
def索引
结束
结束

我试图通过简单地卷曲到ActionCable服务器路由来获得到websocket的连接。这可能吗?

问题是我没有在http请求上发送
源文件
头文件,因此
允许的\u请求\u源文件
无法匹配任何内容。因此,它给出了一个非常模糊的错误消息,关于无法将http连接转换为websocket连接

#page_controller.rb
class PageController < ApplicationController
  def index
  end
end