Overview of the Diaspora* Network
Overview of used technologies
For D*. background processing of jobs is important, because we do a lot of network communication with other servers, and we can't have the UI block while that is taking place. This is taken care of by Sidekiq (another Gem, https://github.com/mperham/sidekiq) and Redis (a key-value store). So, when you write a post, your server saves it to the database and hands processing (e.g. sending your post to users on different servers) over to Sidekiq, which then takes place in the background as a separate process.
Every request goes throug the Rails routing mechanism (http://guides.rubyonrails.org/routing.html) - every URL is mapped to an action inside a controller.
e.g. When a user requests the stream page with the Browser: GET yourpod.net/stream -> StreamsController#multi
When a user writes a new post from the Browser: POST yourpod.net/status_messages -> StatusMessagesController#create
The Diaspora* protocol uses HTTPS as transfer mechanism, so receiving messages from other Server also get routed via Rails to a controller action:
e.g. When a user receives a message from another Server: POST yourpod.net/receive/public -> PublicsController#receive
Rails enforces a Model-View-Controller based approach for application design (http://guides.rubyonrails.org/getting_started.html#the-mvc-architecture) and encourages the developers to stick to REST-ful routes as much as possible (http://guides.rubyonrails.org/getting_started.html#rest).
Controllers can be divided into two basic use-cases: Web UI handling and protocol handling. Web UI contains the normal HTML responses, AJAX responses and some special cases like ATOM feeds or Webfinger for user discovery. The protocol handlers are the entry points for the Diaspora* server-to-server protocol, where messages from other servers are received.