UNPKG

2.04 kBMarkdownView Raw
1<!--
2 This file was generated by emdaer
3
4 Its template can be found at .emdaer/docs/subrequests.emdaer.md
5-->
6
7<!--
8 emdaerHash:2f872adbf20dd06fcd670c40f4c4414c
9-->
10
11<h1 id="subrequests-img-align-right-src-logo-svg-alt-contenta-logo-title-contenta-logo-width-100-">Subrequests <img align="right" src="../logo.svg" alt="Contenta logo" title="Contenta logo" width="100"></h1>
12<p>Subrequests is a request aggregator project that will allow you to turn multiple
13requests into a single one. To do so client-side applications describe the
14requests they want to do in a JSON document and send that document to the
15server. In turn, the server interprets that document, called <em>blueprint</em>, and
16executes all the those requests in the clients behalf.</p>
17<p>There are two big benefits when using this approach:</p>
18<ul>
19<li>There is only one round trip between server an client. The client to server
20communications may be weak (ex: over 3G), but the server to server
21communications are always very reliable.</li>
22<li>If your requests are resolved by the same server processing the blueprints,
23you eliminate completaly the latency introduced by sequential requests. That
24introduces a dramatic performance improvement.</li>
25</ul>
26<p>Subrequests is implemented as a <a href="https://www.drupal.org/project/subrequests">Drupal module</a>
27and as an <a href="https://github.com/e0ipso/subrequests-express">express middleware</a>.
28ContentaJS relies on the nodejs implementation of the
29<a href="http://cgit.drupalcode.org/subrequests/tree/SPECIFICATION.md">Subrequests specification</a>,
30which is exposed in the <code>/subrequests</code> route.</p>
31<p>If you want to learn more about how your client side applications can use
32subrequests to reduce communications latency and improve application performance
33read <a href="https://www.lullabot.com/articles/incredible-decoupled-performance-with-subrequests">this article</a>
34or watch <a href="https://events.drupal.org/nashville2018/sessions/decoupled-drupal-hard-problems">this presentation</a>.</p>