poa-netstats-warehouse/doc/POABackend.Protocol.html

206 lines
5.4 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="ExDoc v0.18.4">
<title>POABackend.Protocol poa_backend v0.1.0</title>
<link rel="stylesheet" href="dist/app-480ffdc169.css" />
<script src="dist/sidebar_items-f62ce50de1.js"></script>
</head>
<body data-type="modules">
<script>try { if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; } catch (e) { }</script>
<div class="main">
<button class="sidebar-button sidebar-toggle">
<span class="icon-menu" aria-hidden="true"></span>
<span class="sr-only">Toggle Sidebar</span>
</button>
<button class="sidebar-button night-mode-toggle">
<span class="icon-theme" aria-hidden="true"></span>
<span class="sr-only">Toggle Theme</span>
</button>
<section class="sidebar">
<a href="POABackend.html" class="sidebar-projectLink">
<div class="sidebar-projectDetails">
<h1 class="sidebar-projectName">
poa_backend
</h1>
<h2 class="sidebar-projectVersion">
v0.1.0
</h2>
</div>
</a>
<form class="sidebar-search" action="search.html">
<button type="submit" class="search-button">
<span class="icon-search" aria-hidden="true"></span>
</button>
<input name="q" type="text" id="search-list" class="search-input" placeholder="Search" aria-label="Search" autocomplete="off" />
</form>
<ul class="sidebar-listNav">
<li><a id="extras-list" href="#full-list">Pages</a></li>
<li><a id="modules-list" href="#full-list">Modules</a></li>
</ul>
<div class="gradient"></div>
<ul id="full-list" class="sidebar-fullList"></ul>
</section>
<section class="content">
<div class="content-outer">
<div id="content" class="content-inner">
<h1>
<small class="visible-xs">poa_backend v0.1.0</small>
POABackend.Protocol
<a href="https://github.com/poanetwork/poa-netstats-wharehouse/blob/v0.1.0/lib/poa_backend/protocol.ex#L1" title="View Source" class="view-source" rel="help">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
</h1>
<section id="moduledoc">
<h2 id="module-poa-protocol" class="section-heading">
<a href="#module-poa-protocol" class="hover-link"><span class="icon-link" aria-hidden="true"></span></a>
POA Protocol
</h2>
<p>This protocol defines the communication between the Agents and the POA Backend.</p>
<p><img src="./backend_architecture.png" alt="POA Backend Architecture"/></p>
<h3 id="module-basic-calls" class="section-heading">
<a href="#module-basic-calls" class="hover-link"><span class="icon-link" aria-hidden="true"></span></a>
Basic calls
</h3>
<p>Only those calls are allowed:</p>
<ul>
<li>session - In order to generate a token/session for authentication/authorization
</li>
<li>ping - Ping message
</li>
<li>data - Specific message for a given receiver. It can be a metric itself or something else
</li>
<li>bye - Message sent when the Agent wants to close the communication explicitly
</li>
</ul>
<h4>session call</h4>
<p>This call is for generate a valid token/session in order to get access to the other calls</p>
<p>abstract request:</p>
<pre><code class="json">{
user: String() # user name
password: String()
}
response:
</code></pre>
<p>{
token: String() # this token must be attached to each call
}</p>
<pre><code class="elixir">
#### ping call
abstract request:
</code></pre>
<p>{
id: String() # agent id
token: String() # generated with a valid user/password calling the <em>session call</em>
}</p>
<pre><code class="elixir">
response:
</code></pre>
<p>{
result: String() # “success” or “error”
payload: String() # optional payload
}</p>
<pre><code class="elixir">
#### data call
abstract request:
</code></pre>
<p>{
id: String() # agent id
token: String() # generated with a valid user/password calling the <em>session call</em>
type: String() # data type (for now only ethereum_metrics)
data: Object() # metric data itself
}</p>
<pre><code class="elixir">
response:
</code></pre>
<p>{
result: String() # “success” or “error”
payload: String() # optional payload
}</p>
<pre><code class="elixir">
#### bye call
abstract request:
</code></pre>
<p>{
id: String() # agent id
token: String() # generated with a valid user/password calling the <em>session call</em>
}</p>
<pre><code class="elixir">
response:
</code></pre>
<p>{
result: String() # “success” or “error”
payload: String() # optional payload
}</p>
<pre><code class="elixir"></code></pre>
</section>
<footer class="footer">
<p>
<span class="line">
Built using
<a href="https://github.com/elixir-lang/ex_doc" title="ExDoc" rel="help" target="_blank">ExDoc</a> (v0.18.4),
</span>
<span class="line">
designed by
<a href="https://twitter.com/dignifiedquire" target="_blank" title="@dignifiedquire">Friedel Ziegelmayer</a>.
</span>
</p>
</footer>
</div>
</div>
</section>
</div>
<script src="dist/app-9bd040e5e5.js"></script>
</body>
</html>