nitro_n2o.htm 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  7. <meta name="description" content="" />
  8. <meta name="author" content="Maxim Sokhatsky" />
  9. <title>NITRO</title>
  10. <link rel="stylesheet" href="https://n2o.dev/blank.css?x=15" />
  11. <link rel="stylesheet" href="https://n2o.dev/zima.css?x=15" />
  12. <link rel="shortcut icon" type="image/x-icon" href="../img/favicon.ico" />
  13. <link rel="apple-touch-icon" sizes="180x180" href="../img/apple-touch-icon.png" />
  14. <link rel="icon" type="image/png" sizes="32x32" href="../img/favicon-32x32.png" />
  15. <link rel="icon" type="image/png" sizes="16x16" href="../img/favicon-16x16.png" />
  16. <link rel="manifest" href="../img/site.webmanifest" />
  17. </head>
  18. <body>
  19. <nav>
  20. <a href="https://n2o.dev">DEV</a>
  21. <a href="https://ws.n2o.dev">N2O</a>
  22. <a href="#" style="background:#ededed;">NITRO</a>
  23. <div class="dropdown">
  24. <a onclick="drop()" class="dropbtn">EN</a>
  25. <div id="dropdown" class="dropdown-content">
  26. <a href="https://n2o.dev/deps/n2o/man/ua/n2o_nitro.htm">UA</a>
  27. <a href="n2o_nitro.htm">EN</a>
  28. </div>
  29. </div>
  30. </nav>
  31. <header>
  32. <a href="../index.html"><img src="https://openmoji.org/data/color/svg/1F525.svg" /></a>
  33. <h1>NITRO</h1>
  34. </header>
  35. <main>
  36. <article>
  37. <section>
  38. <h3>INTRO</h3>
  39. <p>The <a href="https://github.com/synrc/nitro/blob/master/src/nitro_n2o.erl">nitro_n2o</a> module provides
  40. <a href="http://nitrogenproject.com/demos">Nitrogen Web Framework</a>
  41. protocol specification and implementation.</p>
  42. </section>
  43. <section>
  44. <h3>INIT</h3>
  45. <p>Init message invokes event(init) function in page module.
  46. There are two binary representations of INIT message.
  47. The first one is BERT encoded #init record with binary
  48. token that usually issued by n2o_session, transported in #io record
  49. as data parameter and stored on client side in localStorage or Key Chain.
  50. Clients with invalid tokens are being registered and reissued.</p>
  51. <figure>
  52. <code>
  53. -record(init, { token :: binary() }).
  54. </code>
  55. </figure>
  56. <p>The second one is TEXT encoded version of message, &lt;&lt;"N2O,"&gt;&gt;
  57. that usually works for hosts with raw binary falicities as WebSockets.
  58. </p>
  59. <figure>
  60. <code>
  61. &#60;&#60;"N2O,",Token/binary&#62;&#62;
  62. </code>
  63. </figure>
  64. <p>For token issue protocol see <a href="n2o_session.htm">n2o_session</a> module.</p>
  65. </section>
  66. <section>
  67. <h3>PICKLE</h3>
  68. <p>Pickle message sends to server prerendered (by server) encripted message.
  69. These messages hold #ev record with callee information (encripted).
  70. Pickled messaged can prolongate expiration field in session token (renewed)
  71. by updating client token on each UI request (tracking user activity) when
  72. n2o application variable <b>nitro_prolongate</b> equals <b>true</b>.</p>
  73. <div>
  74. <figure>
  75. <code>
  76. -record(pickle, { source = [] :: [] | binary(),
  77. pickled = [] :: [] | binary(),
  78. args = [] :: list({atom(),any()}) }).
  79. -record(ev, { module = [] :: [] | atom(),
  80. msg = [] :: any(),
  81. trigger = [] :: [] | binary(),
  82. name = [] :: [] | binary() }).
  83. </code>
  84. </figure>
  85. </div>
  86. </section>
  87. <section>
  88. <h3>DIRECT</h3>
  89. <p>Direct message sends data without any convertation or encription or session logic.</p>
  90. <div>
  91. <figure>
  92. <code>
  93. -record(direct, { data = [] :: any() }).
  94. </code>
  95. </figure>
  96. </div>
  97. </section>
  98. <section>
  99. <h3>FLUSH</h3>
  100. <p>Flush message only redirects data to the socket.</p>
  101. <div>
  102. <figure>
  103. <code>
  104. -record(flush, { data = [] :: [] | list(#action{}) }).
  105. </code>
  106. </figure>
  107. </div>
  108. </section>
  109. <section>
  110. <p>You may also want to read:
  111. <b><a href="n2o_heart.htm">n2o_heart</a></b>,
  112. <a href="n2o_ftp.htm">n2o_ftp</a>.
  113. </p>
  114. </section>
  115. </article>
  116. </main>
  117. <footer>2005—2019 © Synrc Research Center</footer>
  118. <script>function drop(){document.getElementById("dropdown").classList.toggle("show");}</script>
  119. </body>
  120. </html>