我只是想知道 HTTP 框架在 rails 中的位置以及如何使用不同的网络层为 客户端-服务器通信 实现不同的协议(protocol)?
There's a new protocol called QUIC which has low latency and if somebody wants to implement that in rails app how does someone do it? I hardly found any resources related to the implementation on internet.
最佳答案
据推测,这将由 Rack middleware 处理它位于 Web 服务器和 Rails 代码之间。您的 Rails 应用程序不与 Web 服务器交互,而是与 Rack 交互,Rack 与您的 Web 服务器交互。
Rails <---> Rack <---> Web Server <---> Web Client
Here is a tiny Rack server that says "Hello, world!" .
require "rack"
require "thin"
class HelloWorld
def call(env)
[ 200, { "Content-Type" => "text/plain" }, ["Hello World"] ]
end
end
Rack::Handler::Thin.run HelloWorld.new
Rack::Handler::Thin
与微型 thin
网络服务器对话,向其传递一个由 HTTP 代码、HTTP header 和响应主体组成的响应。
你可能很幸运。 LiteSpeed web server支持 QUIC 和 Rack has a LiteSpeed handler .它可能只是工作。
关于ruby-on-rails - http协议(protocol)在rails框架中的位置在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56092497/