-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFortuneGettingStartedTutorial.html
More file actions
176 lines (174 loc) · 9.46 KB
/
FortuneGettingStartedTutorial.html
File metadata and controls
176 lines (174 loc) · 9.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<!-- HTML header for doxygen 1.9.6-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="$langISO">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.4"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Kourier: Fortune Tutorial</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Ubuntu:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700|Ubuntu+Mono:ital,wght@0,400;0,700;1,400;1,700|Ubuntu+Condensed|Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0|Source+Code+Pro:ital,wght@0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900|Noto+Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900|Source+Sans+Pro:ital,wght@0,200;0,300;0,400;0,600;0,700;0,900;1,200;1,300;1,400;1,600;1,700;1,900" />
<link href="https://fonts.cdnfonts.com/css/bitstream-vera-sans-mono" rel="stylesheet">
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="doxygen-awesome-darkmode-toggle.js"></script>
<script type="text/javascript">
DoxygenAwesomeDarkModeToggle.init()
</script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
$darkmode
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
<link href="doxygen-awesome-sidebar-only.css" rel="stylesheet" type="text/css"/>
<link href="doxygen-awesome-sidebar-only-darkmode-toggle.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">Kourier<span id="projectnumber"> 1.0.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
$(document).ready(function(){initNavTree('FortuneGettingStartedTutorial.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div><div class="header">
<div class="headertitle"><div class="title">Fortune Tutorial </div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p ><a class="anchor" id="md_Tutorials_Fortune_0_GettingStarted"></a> </p>
<h1><a class="anchor" id="autotoc_md80"></a>
Getting Started</h1>
<p >The Fortune tutorial applies all the features Cute provides to developers progressivelly and should be followed step-by-step and in sequence.</p>
<p >Below we highlight the purpose of each section of the tutorial:</p>
<h2><a class="anchor" id="autotoc_md81"></a>
Walking Skeleton</h2>
<ul>
<li>Create the client app for the desktop.</li>
<li>Make the client app interact with remote objects by establishing connections to remote signals and calling remote slots directly.</li>
<li>Create remote objects libraries and configure the Cute Server to load them at startup.</li>
</ul>
<p >In this section, we create the client app. This app is a QtQuick app that connects to the server and keeps showing fortunes on the screen. Clients can also request fortunes directly. On the server side, we create the Fortune remote class, compile it into a library and configure the Cute Server to load the created library at startup. The Fortune remote class sends random fortunes to the client every 5 seconds. Clients can also call directly a remote slot that returns a random fortune on each call.</p>
<h2><a class="anchor" id="autotoc_md82"></a>
Creating iOS Client</h2>
<p >Here we build and deploy the client app to iOS. We show how to set a storyboard and app icons for iOS.</p>
<h2><a class="anchor" id="autotoc_md83"></a>
Creating Android Client</h2>
<p >In this section we build and deploy the client app to Android. We set icons and a splash screen that is shown for 100ms.</p>
<h2><a class="anchor" id="autotoc_md84"></a>
Creating WebAssembly Client</h2>
<p >In this section we build the client app as a Web Application running in the browser using WebAssembly. The web app is supported on desktop and mobile browsers.</p>
<h2><a class="anchor" id="autotoc_md85"></a>
Establising Encrypted Connections</h2>
<ul>
<li>Create self-signed certificates for testing</li>
<li>Configure server to use encrypted connections</li>
<li>Configure one and two-way encryption</li>
<li>Configure the minimum TLS version that the server can accept</li>
</ul>
<p >In this section, we use OpenSSL to create a set of certificates and private keys and apply them to establish encrypted connections with the server.</p>
<h2><a class="anchor" id="autotoc_md86"></a>
Handling HTTP Clients</h2>
<ul>
<li>Create a remote slot and register it as a HTTP handler.</li>
<li>Create console-app that uses QNetworkAccessManager to send HTTP requests to the server.</li>
</ul>
<p >Here we show how to interact with HTTP clients. In this section we create a HTTP handler remote slot that accepts GET requests and sends back to clients a random fortune in the response body.</p>
<h2><a class="anchor" id="autotoc_md87"></a>
Fetching Fortunes from DynamoDB</h2>
<ul>
<li>Introduce the main patterns for enhancing backend code</li>
<li>Make HTTP reqests to other services.</li>
</ul>
<p >In this section we create a DynamoDB instance and fetch fortunes from it using HTTP requests.</p>
<h2><a class="anchor" id="autotoc_md88"></a>
Fetching Fortunes from SQLite</h2>
<ul>
<li>Introduce the main patterns for enhancing backend code</li>
<li>Create a thread pool to run long computations.</li>
</ul>
<p >In this section we store fortunes in a local SQLite database and create a thread pool to query fortunes asynchronously.</p>
<h2><a class="anchor" id="autotoc_md89"></a>
Fetching Fortunes from Microservice</h2>
<ul>
<li>Introduce the main patterns for enhancing backend code</li>
<li>Use instances of the Cute::Client::RemoteObject class to interact with microservices.</li>
</ul>
<p >In this section we show how to fetch fortunes from a microservice using remote signals and slots.</p>
<h2><a class="anchor" id="autotoc_md90"></a>
Authenticating Clients</h2>
<ul>
<li>Use session data to authenticate clients</li>
</ul>
<p >Here we use the session data to authenticate clients and emit signals to communicate to Cute authentication success/failure.</p>
<h2><a class="anchor" id="autotoc_md91"></a>
Applying Rate Limits</h2>
<p >In this section we set rate limits. Clients can request directly 1 fortunes per second with a burst of 3 fortunes and 5 fortunes per minute. We show that the server keeps the rate limiter until its quota is replenished.</p>
<h2><a class="anchor" id="autotoc_md92"></a>
Sending Errors</h2>
<p >Creating server code is a matter of protecting resources. We must diligently monitor, set limits and act to keep resource usage within acceptable limits. Here, we use the SQLite database and force the code that queries it to dealay for some time, making tasks accumulate on the thread pool. We code a limit for the pool and when the remote object fails to queue a task for querying the database, it returns an error code to the client informing that the client is making too many requests. </p>
</div></div><!-- contents -->
</div><!-- PageDoc -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.9.6-->
<!-- start footer part -->
</body>
</html>