我有以下 sinatra 代码,但对于 Rails 应用程序,我该如何做?具体来说,希望在反应器循环内以薄的方式启动轨道,同时在那里也使用 websocket 服务器。
require 'bundler'
Bundler.require
class App < Sinatra::Base
get '/' do
slim :index
end
end
EM.run do
EM::WebSocket.start(:host => '0.0.0.0', :port => 3001) do |ws|
# websocket stuff goes here
end
# start sinatra in a thin server instance here (but i want to start a rails app instead)
Thin::Server.start App, '0.0.0.0', 3000
end