Improves the documentation
[src/app-framework-binder.git] / doc / afb-application-writing.html
index adb5ca7..7c0278d 100644 (file)
@@ -8,18 +8,63 @@
 <h1>HOWTO WRITE an APPLICATION above AGL FRAMEWORK</h1>
 
 <pre><code>version: 1
-Date:    29 mai 2016
+Date:    30 mai 2016
 Author:  José Bollo
 </code></pre>
 
 <p><ul>
  <li><a href="#HOWTO.WRITE.an.APPLICATION.above.AGL.FRAMEWORK">HOWTO WRITE an APPLICATION above AGL FRAMEWORK</a>
  <ul>
+  <li><a href="#Writing.an.HTML5.application">Writing an HTML5 application</a></li>
+  <li><a href="#Writing.a.Qt.application">Writing a Qt application</a></li>
   <li><a href="#Writing.a.C.application">Writing a C application</a></li>
+  <li><a href="#Handling.sessions.within.applications">Handling sessions within applications</a>
+  <ul>
+   <li><a href="#Exchanging.tokens">Exchanging tokens</a></li>
+   <li><a href="#Handling.sessions">Handling sessions</a></li>
+  </ul>
+  </li>
  </ul>
  </li>
 </ul></p>
 
+<a name="Writing.an.HTML5.application"></a>
+<h2>Writing an HTML5 application</h2>
+
+<p>Developpers of HTML5 applications (client side) can easyly create
+applications for AGL framework using their prefered
+HTML framework.</p>
+
+<p>Developpers can also create powerful server side plugins to improve
+their application. This server side plugin should return the mime-type
+application/json and can be accessed either by HTTP or by Websockets.</p>
+
+<p>In a near future, the JSON-RPC protocol will be available together
+with the current x-afb-json1 protocol.</p>
+
+<p>Two examples of HTML5 applications are given:</p>
+
+<ul>
+<li><p><a href="https://github.com/iotbzh/afb-client">afb-client</a> a simple &ldquo;hello world&rdquo; application</p></li>
+<li><p><a href="https://github.com/iotbzh/afm-client">afm-client</a> a simple &ldquo;Home screen&rdquo; application</p></li>
+</ul>
+
+
+<a name="Writing.a.Qt.application"></a>
+<h2>Writing a Qt application</h2>
+
+<p>Writing Qt applications is also possible because Qt offers APIs to
+make HTTP queries and to connect using WebSockets.</p>
+
+<p>It is even possible to write a QML application.
+It is demontrated by the sample application token-websock:</p>
+
+<ul>
+<li><a href="https://github.com/iotbzh/afb-daemon/blob/master/test/token-websock.qml">token-websock</a>
+a simple &ldquo;hello world&rdquo; application in QML</li>
+</ul>
+
+
 <a name="Writing.a.C.application"></a>
 <h2>Writing a C application</h2>
 
@@ -36,5 +81,26 @@ Its source code is here
 <p>The current implementation use libsystemd and file descriptors.
 This may be changed in the future to also support secure sockets
 and being less dependant of libsystemd.</p>
+
+<a name="Handling.sessions.within.applications"></a>
+<h2>Handling sessions within applications</h2>
+
+<a name="Exchanging.tokens"></a>
+<h3>Exchanging tokens</h3>
+
+<p>Applications are communicating with their binder afb-daemon using
+a network connection or a kind of network connection (unix domain
+socket isn&rsquo;t currently implemented but could be used in near future).
+Also, HTTP protocol is not a connected protocol. It means that
+the socket connection can not be used to authenticate a client.</p>
+
+<p>For this reason, the binder should authenticate the application
+by using a commonly shared secret named token.</p>
+
+<p>At start, the framework communicate a common secret to both the binder
+and its client: the application. When the application</p>
+
+<a name="Handling.sessions"></a>
+<h3>Handling sessions</h3>
 </body>
 </html>