ruby - Websocket connection closes without opening on Shotgun server -


I have a Sinatra app that uses webcots.
My app works when I run it with the Ruby App, but when I call it the Shotgun App. Trying to run with rb .

This is in my sending_out.erb :

  "}} connection. Transmission = function (e) {$ ("# msgs"). Attachment (e.data + "
Submit "$ $ (" form "). (Function () {connection}. Send ($ (" Input " ). Val ());});}); & lt; / script>

and it's in my app.rb :

  requires 'sinatra-websocket' set: get socket, [] get '/ send_out' request. Connection | Connection.onopen do connection.send ("hello world!") Settings.sockets & lt; connection connection.send ("opened") connection.send ("gone") end connection. Message | EM.next_tick {settings.sockets.each {| s | | |  

it should be shown

East> Connection opened Hello World! Opened

When I go to the page but it only stops with the shotgun

  view  

and shows only in the console. It is said that the webserocket connection 'ws: //127.0.0.1: 9393 / send_out' has failed: error during WebSocket Handshake: unexpected response code: 500 .

Is there a problem going on with WebSketts shotgun?

The main feature of the shotgun is that it automatically loads your entire code with every request And I think it may also be the problem that you are facing.

Shotgun should be used only for development.

You have many other options available for the purpose of production:

  • Other
  • Ruby server can be compared

    found on

    Comments