Created
June 15, 2015 16:27
-
-
Save tjanczuk/ec666975a0a37d274ae6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.4/raphael-min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-sequence-diagrams/1.0.6/sequence-diagram-min.js"></script> | |
</head> | |
<body> | |
<h2>Bootstrap (I bought a new lock)</h2> | |
<div class="diagram"> | |
participant Phone as P | |
participant Auth0 as A | |
participant Hyperlock service as H | |
participant Lock as L | |
P->A: Authenticate | |
A->P: user_token | |
P->H: Register new lock (user_token) | |
note over H: generate device_token with unique device_id | |
H->P: device_token | |
P->L: [Bluetooth] Initilize (device_token, wifi details) | |
note over L: store device_token, setup wifi | |
</div> | |
<h2>Steady state - actions (lock/unlock/...)</h2> | |
<div class="diagram"> | |
participant Phone as P | |
participant Auth0 as A | |
participant Hyperlock service as H | |
participant Lock as L | |
L->H: long poll (device_token) | |
P->A: Authenticate | |
A->P: user_token | |
P->H: Send message M to device_id (user_token) | |
note over H: authorize, relay to device_id | |
H->L: JSON messages as they come | |
</div> | |
<h2>Steady state - events (locked/unlocked/...)</h2> | |
<div class="diagram"> | |
participant Phone as P | |
participant Auth0 as A | |
participant Hyperlock service as H | |
participant Lock as L | |
L->H: Event (device_token) | |
note over H: store in DB, send SMS, call webtask... | |
H->P: notification | |
P->A: Authenticate | |
A->P: user_token | |
P->H: query events (user_token) | |
</div> | |
<script> | |
$(".diagram").sequenceDiagram({theme: 'hand'}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment