Tag: websocket rails

带有Rails的Websockets(Puma) – WebSocket握手期间出错:意外的响应代码:200

我试图在我的Rails4.1应用程序中使用websocket 以下是一些相关的代码片段: 的Gemfile: gem ‘websocket-rails’ gem ‘puma’ development.rb config.middleware.delete Rack::Lock 我在本地启动服务器: bundle exec puma -p 3000 在chrome控制台中,我看到一个连接错误: new WebSocketRails(‘localhost:3000/post/hello’, true); WebSocket connection to ‘ws://localhost:3000/post/hello’ failed: Error during WebSocket handshake: Unexpected response code: 200 任何人都可以帮助我在Rails中本地使用Web套接字需要做什么? UPDATE1 当我在Unicorn服务器上运行时,我尝试按照我的Rails应用程序中不起作用的Websockets添加以下内容,但是在瘦服务器上运行但是它没有帮助 初始化/ eventmachine.rb Thread.new { EventMachine.run } unless EventMachine.reactor_running? && EventMachine.reactor_thread.alive