Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does http protocol rests in rails framework?

I just wanted to know that where does the HTTP framework rests in rails and how to implement a different protocol for client-server communication using different network layer?

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.

like image 786
Nischay Namdev Avatar asked Oct 24 '25 14:10

Nischay Namdev


1 Answers

At a guess, this would be handled by the Rack middleware that sits between the web server and your Rails code. Your Rails application does not interact with the web server, rather it interacts with Rack which interacts with your web server.

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 talks to the tiny thin web server passing it a response consisting of an HTTP code, HTTP headers, and the response body.

You may be in luck. The LiteSpeed web server supports QUIC and Rack has a LiteSpeed handler. It might Just Work.

like image 167
Schwern Avatar answered Oct 27 '25 04:10

Schwern