Skip to content

Commit

Permalink
basics: Adding image with example of requests
Browse files Browse the repository at this point in the history
  • Loading branch information
balat committed Jan 19, 2024
1 parent 84c3a5d commit 5a2b2ff
Show file tree
Hide file tree
Showing 4 changed files with 1,128 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tutos/7.1/manual/basics.wiki
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,17 @@ let%client c : int = 3 + ~%x

<<div class="focused"|
===How it works===

The following picture shows two examples of requests:
* First, the browser ask for a new page, and the server generates the page
* then the user clicks on a link in the page, and the page is generated by the client-side program (because the service is registered on both sides). In this example, while generating the page, the client does a rpc to the server.
In both cases (first request or rpc), the server returns the expected value, but also the value of injections and an order for the client-side program to execute the client-values met during te server-side computation.

@@class="centered"@@{{@@class="img-col-width-400"@@files/tutorial/client-server-req.svg|Example of requests}}

Tip: You can avoid waiting for the rpc to return by using a spinner from Ocsigen Toolkit. Thus, the client-side generated page will be displayed without delay.

Regardless of the construction used and their combination, there is
only one communication from server to client, when the Web page is
sent. This is due to the fact that client fragments are not executed
Expand Down
Loading

0 comments on commit 5a2b2ff

Please sign in to comment.