Python Library Socket Protocol
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

index.html 69KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882
  1. <!DOCTYPE html>
  2. <html class="writer-html4" lang="en" >
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Welcome to socket_protocol’s documentation! &mdash; socket_protocol documentation</title>
  7. <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  8. <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  9. <!--[if lt IE 9]>
  10. <script src="_static/js/html5shiv.min.js"></script>
  11. <![endif]-->
  12. <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
  13. <script type="text/javascript" src="_static/jquery.js"></script>
  14. <script type="text/javascript" src="_static/underscore.js"></script>
  15. <script type="text/javascript" src="_static/doctools.js"></script>
  16. <script type="text/javascript" src="_static/language_data.js"></script>
  17. <script type="text/javascript" src="_static/js/theme.js"></script>
  18. <link rel="index" title="Index" href="genindex.html" />
  19. <link rel="search" title="Search" href="search.html" />
  20. </head>
  21. <body class="wy-body-for-nav">
  22. <div class="wy-grid-for-nav">
  23. <nav data-toggle="wy-nav-shift" class="wy-nav-side">
  24. <div class="wy-side-scroll">
  25. <div class="wy-side-nav-search" >
  26. <a href="#" class="icon icon-home" alt="Documentation Home"> socket_protocol
  27. </a>
  28. <div role="search">
  29. <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
  30. <input type="text" name="q" placeholder="Search docs" />
  31. <input type="hidden" name="check_keywords" value="yes" />
  32. <input type="hidden" name="area" value="default" />
  33. </form>
  34. </div>
  35. </div>
  36. <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
  37. <!-- Local TOC -->
  38. <div class="local-toc"><ul>
  39. <li><a class="reference internal" href="#">Welcome to socket_protocol’s documentation!</a><ul>
  40. <li><a class="reference internal" href="#socket-protocol-socket-protocol">socket_protocol (Socket Protocol)</a></li>
  41. </ul>
  42. </li>
  43. <li><a class="reference internal" href="#indices-and-tables">Indices and tables</a></li>
  44. </ul>
  45. </div>
  46. </div>
  47. </div>
  48. </nav>
  49. <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
  50. <nav class="wy-nav-top" aria-label="top navigation">
  51. <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
  52. <a href="#">socket_protocol</a>
  53. </nav>
  54. <div class="wy-nav-content">
  55. <div class="rst-content">
  56. <div role="navigation" aria-label="breadcrumbs navigation">
  57. <ul class="wy-breadcrumbs">
  58. <li><a href="#" class="icon icon-home"></a> &raquo;</li>
  59. <li>Welcome to socket_protocol’s documentation!</li>
  60. <li class="wy-breadcrumbs-aside">
  61. <a href="_sources/index.rst.txt" rel="nofollow"> View page source</a>
  62. </li>
  63. </ul>
  64. <hr/>
  65. </div>
  66. <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
  67. <div itemprop="articleBody">
  68. <div class="section" id="module-socket_protocol">
  69. <span id="welcome-to-socket-protocol-s-documentation"></span><h1>Welcome to socket_protocol’s documentation!<a class="headerlink" href="#module-socket_protocol" title="Permalink to this headline">¶</a></h1>
  70. <div class="section" id="socket-protocol-socket-protocol">
  71. <h2>socket_protocol (Socket Protocol)<a class="headerlink" href="#socket-protocol-socket-protocol" title="Permalink to this headline">¶</a></h2>
  72. <p><strong>Author:</strong></p>
  73. <ul class="simple">
  74. <li>Dirk Alders &lt;<a class="reference external" href="mailto:sudo-dirk&#37;&#52;&#48;mount-mockery&#46;de">sudo-dirk<span>&#64;</span>mount-mockery<span>&#46;</span>de</a>&gt;</li>
  75. </ul>
  76. <p><strong>Description:</strong></p>
  77. <blockquote>
  78. <div>This Module supports point to point communication for client-server issues.</div></blockquote>
  79. <p><strong>Submodules:</strong></p>
  80. <ul class="simple">
  81. <li><a class="reference internal" href="#socket_protocol.data_storage" title="socket_protocol.data_storage"><code class="xref py py-class docutils literal notranslate"><span class="pre">socket_protocol.data_storage</span></code></a></li>
  82. <li><a class="reference internal" href="#socket_protocol.pure_json_protocol" title="socket_protocol.pure_json_protocol"><code class="xref py py-class docutils literal notranslate"><span class="pre">socket_protocol.pure_json_protocol</span></code></a></li>
  83. <li><a class="reference internal" href="#socket_protocol.struct_json_protocol" title="socket_protocol.struct_json_protocol"><code class="xref py py-class docutils literal notranslate"><span class="pre">socket_protocol.struct_json_protocol</span></code></a></li>
  84. </ul>
  85. <p><strong>Unittest:</strong></p>
  86. <blockquote>
  87. <div>See also the <a class="reference download internal" download="" href="_downloads/37503cb17b21b2c78bb8b07730976f24/unittest.pdf"><code class="xref download docutils literal notranslate"><span class="pre">unittest</span></code></a> documentation.</div></blockquote>
  88. <p><strong>Module Documentation:</strong></p>
  89. <dl class="data">
  90. <dt id="socket_protocol.AUTH_STATE_KEY_TRANSFERRED">
  91. <code class="descclassname">socket_protocol.</code><code class="descname">AUTH_STATE_KEY_TRANSFERRED</code><em class="property"> = 3</em><a class="headerlink" href="#socket_protocol.AUTH_STATE_KEY_TRANSFERRED" title="Permalink to this definition">¶</a></dt>
  92. <dd><p>Authentification Status for ‘Key has been sent’</p>
  93. </dd></dl>
  94. <dl class="data">
  95. <dt id="socket_protocol.AUTH_STATE_SEED_REQUESTED">
  96. <code class="descclassname">socket_protocol.</code><code class="descname">AUTH_STATE_SEED_REQUESTED</code><em class="property"> = 1</em><a class="headerlink" href="#socket_protocol.AUTH_STATE_SEED_REQUESTED" title="Permalink to this definition">¶</a></dt>
  97. <dd><p>Authentification Status for ‘Seed was requested’</p>
  98. </dd></dl>
  99. <dl class="data">
  100. <dt id="socket_protocol.AUTH_STATE_SEED_TRANSFERRED">
  101. <code class="descclassname">socket_protocol.</code><code class="descname">AUTH_STATE_SEED_TRANSFERRED</code><em class="property"> = 2</em><a class="headerlink" href="#socket_protocol.AUTH_STATE_SEED_TRANSFERRED" title="Permalink to this definition">¶</a></dt>
  102. <dd><p>Authentification Status for ‘Seed has been sent’</p>
  103. </dd></dl>
  104. <dl class="data">
  105. <dt id="socket_protocol.AUTH_STATE_TRUSTED_CONNECTION">
  106. <code class="descclassname">socket_protocol.</code><code class="descname">AUTH_STATE_TRUSTED_CONNECTION</code><em class="property"> = 4</em><a class="headerlink" href="#socket_protocol.AUTH_STATE_TRUSTED_CONNECTION" title="Permalink to this definition">¶</a></dt>
  107. <dd><p>Authentification Status for a ‘Trusted Connection’</p>
  108. </dd></dl>
  109. <dl class="data">
  110. <dt id="socket_protocol.AUTH_STATE_UNTRUSTED_CONNECTION">
  111. <code class="descclassname">socket_protocol.</code><code class="descname">AUTH_STATE_UNTRUSTED_CONNECTION</code><em class="property"> = 0</em><a class="headerlink" href="#socket_protocol.AUTH_STATE_UNTRUSTED_CONNECTION" title="Permalink to this definition">¶</a></dt>
  112. <dd><p>Authentification Status for an ‘Untrusted Connection’</p>
  113. </dd></dl>
  114. <dl class="data">
  115. <dt id="socket_protocol.AUTH_STATE__NAMES">
  116. <code class="descclassname">socket_protocol.</code><code class="descname">AUTH_STATE__NAMES</code><em class="property"> = {0: 'Untrusted Connection', 1: 'Seed was requested', 2: 'Seed has been sent', 3: 'Key has been sent', 4: 'Trusted Connection'}</em><a class="headerlink" href="#socket_protocol.AUTH_STATE__NAMES" title="Permalink to this definition">¶</a></dt>
  117. <dd><p>Authentification Status names for previous defined authentification states</p>
  118. </dd></dl>
  119. <dl class="data">
  120. <dt id="socket_protocol.DID_AUTH_KEY">
  121. <code class="descclassname">socket_protocol.</code><code class="descname">DID_AUTH_KEY</code><em class="property"> = 1</em><a class="headerlink" href="#socket_protocol.DID_AUTH_KEY" title="Permalink to this definition">¶</a></dt>
  122. <dd><p>DID for authentification (key)</p>
  123. </dd></dl>
  124. <dl class="data">
  125. <dt id="socket_protocol.DID_AUTH_SEED">
  126. <code class="descclassname">socket_protocol.</code><code class="descname">DID_AUTH_SEED</code><em class="property"> = 0</em><a class="headerlink" href="#socket_protocol.DID_AUTH_SEED" title="Permalink to this definition">¶</a></dt>
  127. <dd><p>DID for authentification (seed)</p>
  128. </dd></dl>
  129. <dl class="data">
  130. <dt id="socket_protocol.DID_CHANNEL_NAME">
  131. <code class="descclassname">socket_protocol.</code><code class="descname">DID_CHANNEL_NAME</code><em class="property"> = 0</em><a class="headerlink" href="#socket_protocol.DID_CHANNEL_NAME" title="Permalink to this definition">¶</a></dt>
  132. <dd><p>DID for channel name</p>
  133. </dd></dl>
  134. <dl class="exception">
  135. <dt id="socket_protocol.RequestSidExistsError">
  136. <em class="property">exception </em><code class="descclassname">socket_protocol.</code><code class="descname">RequestSidExistsError</code><a class="headerlink" href="#socket_protocol.RequestSidExistsError" title="Permalink to this definition">¶</a></dt>
  137. <dd></dd></dl>
  138. <dl class="exception">
  139. <dt id="socket_protocol.ResponseSidExistsError">
  140. <em class="property">exception </em><code class="descclassname">socket_protocol.</code><code class="descname">ResponseSidExistsError</code><a class="headerlink" href="#socket_protocol.ResponseSidExistsError" title="Permalink to this definition">¶</a></dt>
  141. <dd></dd></dl>
  142. <dl class="data">
  143. <dt id="socket_protocol.SID_AUTH_REQUEST">
  144. <code class="descclassname">socket_protocol.</code><code class="descname">SID_AUTH_REQUEST</code><em class="property"> = 0</em><a class="headerlink" href="#socket_protocol.SID_AUTH_REQUEST" title="Permalink to this definition">¶</a></dt>
  145. <dd><p>SID for authentification request</p>
  146. </dd></dl>
  147. <dl class="data">
  148. <dt id="socket_protocol.SID_AUTH_RESPONSE">
  149. <code class="descclassname">socket_protocol.</code><code class="descname">SID_AUTH_RESPONSE</code><em class="property"> = 1</em><a class="headerlink" href="#socket_protocol.SID_AUTH_RESPONSE" title="Permalink to this definition">¶</a></dt>
  150. <dd><p>SID for authentification response</p>
  151. </dd></dl>
  152. <dl class="data">
  153. <dt id="socket_protocol.SID_CHANNEL_NAME_REQUEST">
  154. <code class="descclassname">socket_protocol.</code><code class="descname">SID_CHANNEL_NAME_REQUEST</code><em class="property"> = 8</em><a class="headerlink" href="#socket_protocol.SID_CHANNEL_NAME_REQUEST" title="Permalink to this definition">¶</a></dt>
  155. <dd><p>SID for channel name exchange request</p>
  156. </dd></dl>
  157. <dl class="data">
  158. <dt id="socket_protocol.SID_CHANNEL_NAME_RESPONSE">
  159. <code class="descclassname">socket_protocol.</code><code class="descname">SID_CHANNEL_NAME_RESPONSE</code><em class="property"> = 9</em><a class="headerlink" href="#socket_protocol.SID_CHANNEL_NAME_RESPONSE" title="Permalink to this definition">¶</a></dt>
  160. <dd><p>SID for channel name exchange response</p>
  161. </dd></dl>
  162. <dl class="data">
  163. <dt id="socket_protocol.SID_EXECUTE_REQUEST">
  164. <code class="descclassname">socket_protocol.</code><code class="descname">SID_EXECUTE_REQUEST</code><em class="property"> = 30</em><a class="headerlink" href="#socket_protocol.SID_EXECUTE_REQUEST" title="Permalink to this definition">¶</a></dt>
  165. <dd><p>SID for a execute request</p>
  166. </dd></dl>
  167. <dl class="data">
  168. <dt id="socket_protocol.SID_EXECUTE_RESPONSE">
  169. <code class="descclassname">socket_protocol.</code><code class="descname">SID_EXECUTE_RESPONSE</code><em class="property"> = 31</em><a class="headerlink" href="#socket_protocol.SID_EXECUTE_RESPONSE" title="Permalink to this definition">¶</a></dt>
  170. <dd><p>SID for a execute response</p>
  171. </dd></dl>
  172. <dl class="data">
  173. <dt id="socket_protocol.SID_READ_REQUEST">
  174. <code class="descclassname">socket_protocol.</code><code class="descname">SID_READ_REQUEST</code><em class="property"> = 10</em><a class="headerlink" href="#socket_protocol.SID_READ_REQUEST" title="Permalink to this definition">¶</a></dt>
  175. <dd><p>SID for a read data request</p>
  176. </dd></dl>
  177. <dl class="data">
  178. <dt id="socket_protocol.SID_READ_RESPONSE">
  179. <code class="descclassname">socket_protocol.</code><code class="descname">SID_READ_RESPONSE</code><em class="property"> = 11</em><a class="headerlink" href="#socket_protocol.SID_READ_RESPONSE" title="Permalink to this definition">¶</a></dt>
  180. <dd><p>SID for read data response</p>
  181. </dd></dl>
  182. <dl class="data">
  183. <dt id="socket_protocol.SID_WRITE_REQUEST">
  184. <code class="descclassname">socket_protocol.</code><code class="descname">SID_WRITE_REQUEST</code><em class="property"> = 20</em><a class="headerlink" href="#socket_protocol.SID_WRITE_REQUEST" title="Permalink to this definition">¶</a></dt>
  185. <dd><p>SID for a write data request</p>
  186. </dd></dl>
  187. <dl class="data">
  188. <dt id="socket_protocol.SID_WRITE_RESPONSE">
  189. <code class="descclassname">socket_protocol.</code><code class="descname">SID_WRITE_RESPONSE</code><em class="property"> = 21</em><a class="headerlink" href="#socket_protocol.SID_WRITE_RESPONSE" title="Permalink to this definition">¶</a></dt>
  190. <dd><p>SID for a write data response</p>
  191. </dd></dl>
  192. <dl class="data">
  193. <dt id="socket_protocol.STATUS_AUTH_REQUIRED">
  194. <code class="descclassname">socket_protocol.</code><code class="descname">STATUS_AUTH_REQUIRED</code><em class="property"> = 3</em><a class="headerlink" href="#socket_protocol.STATUS_AUTH_REQUIRED" title="Permalink to this definition">¶</a></dt>
  195. <dd><p>Status for ‘authentification is required’</p>
  196. </dd></dl>
  197. <dl class="data">
  198. <dt id="socket_protocol.STATUS_BUFFERING_UNHANDLED_REQUEST">
  199. <code class="descclassname">socket_protocol.</code><code class="descname">STATUS_BUFFERING_UNHANDLED_REQUEST</code><em class="property"> = 1</em><a class="headerlink" href="#socket_protocol.STATUS_BUFFERING_UNHANDLED_REQUEST" title="Permalink to this definition">¶</a></dt>
  200. <dd><p>Status for ‘unhandled request’</p>
  201. </dd></dl>
  202. <dl class="data">
  203. <dt id="socket_protocol.STATUS_CALLBACK_ERROR">
  204. <code class="descclassname">socket_protocol.</code><code class="descname">STATUS_CALLBACK_ERROR</code><em class="property"> = 2</em><a class="headerlink" href="#socket_protocol.STATUS_CALLBACK_ERROR" title="Permalink to this definition">¶</a></dt>
  205. <dd><p>Status for ‘callback errors’</p>
  206. </dd></dl>
  207. <dl class="data">
  208. <dt id="socket_protocol.STATUS_CHECKSUM_ERROR">
  209. <code class="descclassname">socket_protocol.</code><code class="descname">STATUS_CHECKSUM_ERROR</code><em class="property"> = 5</em><a class="headerlink" href="#socket_protocol.STATUS_CHECKSUM_ERROR" title="Permalink to this definition">¶</a></dt>
  210. <dd><p>Status for ‘checksum error’</p>
  211. </dd></dl>
  212. <dl class="data">
  213. <dt id="socket_protocol.STATUS_LOG_LVL">
  214. <code class="descclassname">socket_protocol.</code><code class="descname">STATUS_LOG_LVL</code><em class="property"> = {0: 20, 1: 30, 2: 40, 3: 30, 4: 40, 5: 40, 6: 30}</em><a class="headerlink" href="#socket_protocol.STATUS_LOG_LVL" title="Permalink to this definition">¶</a></dt>
  215. <dd><p>Status depending log level for messages</p>
  216. </dd></dl>
  217. <dl class="data">
  218. <dt id="socket_protocol.STATUS_OKAY">
  219. <code class="descclassname">socket_protocol.</code><code class="descname">STATUS_OKAY</code><em class="property"> = 0</em><a class="headerlink" href="#socket_protocol.STATUS_OKAY" title="Permalink to this definition">¶</a></dt>
  220. <dd><p>Status for ‘okay’</p>
  221. </dd></dl>
  222. <dl class="data">
  223. <dt id="socket_protocol.STATUS_OPERATION_NOT_PERMITTED">
  224. <code class="descclassname">socket_protocol.</code><code class="descname">STATUS_OPERATION_NOT_PERMITTED</code><em class="property"> = 6</em><a class="headerlink" href="#socket_protocol.STATUS_OPERATION_NOT_PERMITTED" title="Permalink to this definition">¶</a></dt>
  225. <dd><p>Status for ‘operation not permitted’</p>
  226. </dd></dl>
  227. <dl class="data">
  228. <dt id="socket_protocol.STATUS_SERVICE_OR_DATA_UNKNOWN">
  229. <code class="descclassname">socket_protocol.</code><code class="descname">STATUS_SERVICE_OR_DATA_UNKNOWN</code><em class="property"> = 4</em><a class="headerlink" href="#socket_protocol.STATUS_SERVICE_OR_DATA_UNKNOWN" title="Permalink to this definition">¶</a></dt>
  230. <dd><p>Status for ‘service or data unknown’</p>
  231. </dd></dl>
  232. <dl class="class">
  233. <dt id="socket_protocol.data_storage">
  234. <em class="property">class </em><code class="descclassname">socket_protocol.</code><code class="descname">data_storage</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#socket_protocol.data_storage" title="Permalink to this definition">¶</a></dt>
  235. <dd><p>This is a storage object for socket_protocol messages.</p>
  236. <table class="docutils field-list" frame="void" rules="none">
  237. <col class="field-name" />
  238. <col class="field-body" />
  239. <tbody valign="top">
  240. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
  241. <li><strong>status</strong> (<em>int</em>) – The message status.</li>
  242. <li><strong>service_id</strong> (<em>int</em>) – The Service-ID.</li>
  243. <li><strong>data_id</strong> (<em>int</em>) – The Data-ID.</li>
  244. <li><strong>data</strong> (<em>any</em>) – The transfered data.</li>
  245. </ul>
  246. </td>
  247. </tr>
  248. </tbody>
  249. </table>
  250. <dl class="method">
  251. <dt id="socket_protocol.data_storage.get_data">
  252. <code class="descname">get_data</code><span class="sig-paren">(</span><em>default=None</em><span class="sig-paren">)</span><a class="headerlink" href="#socket_protocol.data_storage.get_data" title="Permalink to this definition">¶</a></dt>
  253. <dd><p>This Method returns the message data.</p>
  254. <table class="docutils field-list" frame="void" rules="none">
  255. <col class="field-name" />
  256. <col class="field-body" />
  257. <tbody valign="top">
  258. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>default</strong> – The default value, if no data is available.</td>
  259. </tr>
  260. </tbody>
  261. </table>
  262. </dd></dl>
  263. <dl class="method">
  264. <dt id="socket_protocol.data_storage.get_data_id">
  265. <code class="descname">get_data_id</code><span class="sig-paren">(</span><em>default=None</em><span class="sig-paren">)</span><a class="headerlink" href="#socket_protocol.data_storage.get_data_id" title="Permalink to this definition">¶</a></dt>
  266. <dd><p>This Method returns the message Data-ID.</p>
  267. <table class="docutils field-list" frame="void" rules="none">
  268. <col class="field-name" />
  269. <col class="field-body" />
  270. <tbody valign="top">
  271. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>default</strong> – The default value, if no data is available.</td>
  272. </tr>
  273. </tbody>
  274. </table>
  275. </dd></dl>
  276. <dl class="method">
  277. <dt id="socket_protocol.data_storage.get_service_id">
  278. <code class="descname">get_service_id</code><span class="sig-paren">(</span><em>default=None</em><span class="sig-paren">)</span><a class="headerlink" href="#socket_protocol.data_storage.get_service_id" title="Permalink to this definition">¶</a></dt>
  279. <dd><p>This Method returns the message Service-ID.</p>
  280. <table class="docutils field-list" frame="void" rules="none">
  281. <col class="field-name" />
  282. <col class="field-body" />
  283. <tbody valign="top">
  284. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>default</strong> – The default value, if no data is available.</td>
  285. </tr>
  286. </tbody>
  287. </table>
  288. </dd></dl>
  289. <dl class="method">
  290. <dt id="socket_protocol.data_storage.get_status">
  291. <code class="descname">get_status</code><span class="sig-paren">(</span><em>default=None</em><span class="sig-paren">)</span><a class="headerlink" href="#socket_protocol.data_storage.get_status" title="Permalink to this definition">¶</a></dt>
  292. <dd><p>This Method returns the message status.</p>
  293. <table class="docutils field-list" frame="void" rules="none">
  294. <col class="field-name" />
  295. <col class="field-body" />
  296. <tbody valign="top">
  297. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>default</strong> – The default value, if no data is available.</td>
  298. </tr>
  299. </tbody>
  300. </table>
  301. </dd></dl>
  302. </dd></dl>
  303. <dl class="class">
  304. <dt id="socket_protocol.pure_json_protocol">
  305. <em class="property">class </em><code class="descclassname">socket_protocol.</code><code class="descname">pure_json_protocol</code><span class="sig-paren">(</span><em>comm_instance</em>, <em>secret=None</em>, <em>auto_auth=False</em>, <em>channel_name=None</em><span class="sig-paren">)</span><a class="headerlink" href="#socket_protocol.pure_json_protocol" title="Permalink to this definition">¶</a></dt>
  306. <dd><p>This <cite>class</cite> supports to transfer a message and it’s data.</p>
  307. <table class="docutils field-list" frame="void" rules="none">
  308. <col class="field-name" />
  309. <col class="field-body" />
  310. <tbody valign="top">
  311. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
  312. <li><strong>comm_instance</strong> (<em>instance</em>) – A communication instance.</li>
  313. <li><strong>secret</strong> (<em>str</em>) – An optinal secret (e.g. created by <code class="docutils literal notranslate"><span class="pre">binascii.hexlify(os.urandom(24))</span></code>).</li>
  314. <li><strong>auto_auth</strong> (<em>bool</em>) – An optional parameter to enable (True) automatic authentification, otherwise you need to do it manually, if needed.</li>
  315. <li><strong>channel_name</strong> (<em>str</em>) – An optional parameter to set a channel name for logging of the communication.</li>
  316. </ul>
  317. </td>
  318. </tr>
  319. </tbody>
  320. </table>
  321. <div class="admonition hint">
  322. <p class="first admonition-title">Hint</p>
  323. <ul class="last simple">
  324. <li>The Service-ID is designed to identify the type of the communication (e.g. <code class="xref py py-const docutils literal notranslate"><span class="pre">READ_REQUEST</span></code>, <code class="xref py py-const docutils literal notranslate"><span class="pre">WRITE_REQUEST</span></code>, <code class="xref py py-const docutils literal notranslate"><span class="pre">READ_RESPONSE</span></code>, <code class="xref py py-const docutils literal notranslate"><span class="pre">WRITE_RESPONSE</span></code>, …)</li>
  325. <li>The Data-ID is designed to identify the requests / responses using the same Service_ID.</li>
  326. </ul>
  327. </div>
  328. <div class="admonition note">
  329. <p class="first admonition-title">Note</p>
  330. <p>The <code class="xref py py-class docutils literal notranslate"><span class="pre">comm_instance</span></code> needs to have at least the following interface:</p>
  331. <ul class="last simple">
  332. <li>A Method <code class="xref py py-func docutils literal notranslate"><span class="pre">comm_instance.init_channel_name()</span></code> to set the channel name.</li>
  333. <li>A Constant <code class="xref py py-const docutils literal notranslate"><span class="pre">comm_instance.IS_CLIENT</span></code> to identify that the <code class="xref py py-class docutils literal notranslate"><span class="pre">comm_instance</span></code> is a client (True) or a server (False).</li>
  334. <li>A Method <code class="xref py py-func docutils literal notranslate"><span class="pre">comm_instance.is_connected()</span></code> to identify if the instance is connected (True) or not (False).</li>
  335. <li>A Method <code class="xref py py-func docutils literal notranslate"><span class="pre">comm_instance.reconnect()</span></code> to initiate a reconnect.</li>
  336. <li>A Method <code class="xref py py-func docutils literal notranslate"><span class="pre">comm_instance.register_callback()</span></code> to register a data available callback.</li>
  337. <li>A Method <code class="xref py py-func docutils literal notranslate"><span class="pre">comm_instance.register_connect_callback()</span></code> to register a connect callback.</li>
  338. <li>A Method <code class="xref py py-func docutils literal notranslate"><span class="pre">comm_instance.register_disconnect_callback()</span></code> to register a disconnect callback.</li>
  339. <li>A Method <code class="xref py py-func docutils literal notranslate"><span class="pre">comm_instance.send()</span></code> to send data via the <code class="xref py py-class docutils literal notranslate"><span class="pre">comm_instance</span></code>.</li>
  340. </ul>
  341. </div>
  342. <div class="admonition note">
  343. <p class="first admonition-title">Note</p>
  344. <p class="last">The parameter <code class="xref py py-const docutils literal notranslate"><span class="pre">auto_auth</span></code> is only relevant, if a secret is given and the <code class="xref py py-class docutils literal notranslate"><span class="pre">comm_instance</span></code> is a client. The authentification is initiated directly after the connection is established.</p>
  345. </div>
  346. <div class="admonition note">
  347. <p class="first admonition-title">Note</p>
  348. <p>The <code class="xref py py-const docutils literal notranslate"><span class="pre">channel_name</span></code>-exchange will be initiated by the client directly after the the connection is established.</p>
  349. <ul class="last simple">
  350. <li>If a channel_name is given at both communication sides and they are different, the client name is taken over and the server will log a warning message.</li>
  351. </ul>
  352. </div>
  353. <p><strong>Example:</strong></p>
  354. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">sys</span>
  355. <span class="n">sys</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s1">&#39;../..&#39;</span><span class="p">)</span>
  356. <span class="kn">import</span> <span class="nn">report</span>
  357. <span class="kn">import</span> <span class="nn">socket_protocol</span>
  358. <span class="kn">from</span> <span class="nn">socket_protocol_server</span> <span class="k">import</span> <span class="n">example_protocol</span><span class="p">,</span> <span class="n">DID_ASC_TIME</span>
  359. <span class="kn">import</span> <span class="nn">tcp_socket</span>
  360. <span class="kn">import</span> <span class="nn">time</span>
  361. <span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s1">&#39;__main__&#39;</span><span class="p">:</span>
  362. <span class="n">report</span><span class="o">.</span><span class="n">stdoutLoggingConfigure</span><span class="p">(</span><span class="n">log_name_lvl</span><span class="o">=</span><span class="p">[(</span><span class="s1">&#39;root&#39;</span><span class="p">,</span> <span class="s1">&#39;INFO&#39;</span><span class="p">),</span> <span class="p">])</span>
  363. <span class="n">c</span> <span class="o">=</span> <span class="n">tcp_socket</span><span class="o">.</span><span class="n">tcp_client_stp</span><span class="p">(</span><span class="s1">&#39;127.0.0.1&#39;</span><span class="p">,</span> <span class="mi">17017</span><span class="p">)</span>
  364. <span class="n">sp</span> <span class="o">=</span> <span class="n">example_protocol</span><span class="p">(</span><span class="n">c</span><span class="p">,</span> <span class="n">channel_name</span><span class="o">=</span><span class="s1">&#39;example_client&#39;</span><span class="p">)</span>
  365. <span class="n">sp</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="n">socket_protocol</span><span class="o">.</span><span class="n">SID_READ_REQUEST</span><span class="p">,</span> <span class="n">DID_ASC_TIME</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
  366. <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;The Client received: </span><span class="si">%s</span><span class="s1">&#39;</span> <span class="o">%</span> <span class="nb">repr</span><span class="p">(</span><span class="n">sp</span><span class="o">.</span><span class="n">receive</span><span class="p">(</span><span class="n">socket_protocol</span><span class="o">.</span><span class="n">SID_READ_RESPONSE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span><span class="o">.</span><span class="n">get_data</span><span class="p">()))</span>
  367. </pre></div>
  368. </div>
  369. <p>and</p>
  370. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">sys</span>
  371. <span class="n">sys</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s1">&#39;../..&#39;</span><span class="p">)</span>
  372. <span class="kn">import</span> <span class="nn">report</span>
  373. <span class="kn">import</span> <span class="nn">socket_protocol</span>
  374. <span class="kn">import</span> <span class="nn">tcp_socket</span>
  375. <span class="kn">import</span> <span class="nn">time</span>
  376. <span class="n">DID_ASC_TIME</span> <span class="o">=</span> <span class="mi">0</span>
  377. <span class="k">class</span> <span class="nc">example_protocol</span><span class="p">(</span><span class="n">socket_protocol</span><span class="o">.</span><span class="n">pure_json_protocol</span><span class="p">):</span>
  378. <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
  379. <span class="n">socket_protocol</span><span class="o">.</span><span class="n">pure_json_protocol</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
  380. <span class="c1">#</span>
  381. <span class="bp">self</span><span class="o">.</span><span class="n">add_data</span><span class="p">((</span><span class="n">socket_protocol</span><span class="o">.</span><span class="n">SID_READ_REQUEST</span><span class="p">,</span> <span class="n">socket_protocol</span><span class="o">.</span><span class="n">SID_READ_RESPONSE</span><span class="p">),</span> <span class="n">DID_ASC_TIME</span><span class="p">,</span> <span class="s1">&#39;asc_time&#39;</span><span class="p">)</span>
  382. <span class="c1">#</span>
  383. <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">__comm_inst__</span><span class="o">.</span><span class="n">IS_CLIENT</span><span class="p">:</span>
  384. <span class="bp">self</span><span class="o">.</span><span class="n">register_callback</span><span class="p">(</span><span class="n">socket_protocol</span><span class="o">.</span><span class="n">SID_READ_REQUEST</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">time_callback</span><span class="p">)</span>
  385. <span class="k">def</span> <span class="nf">time_callback</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">msg</span><span class="p">):</span>
  386. <span class="k">if</span> <span class="n">msg</span><span class="o">.</span><span class="n">get_status</span><span class="p">()</span> <span class="o">==</span> <span class="n">socket_protocol</span><span class="o">.</span><span class="n">STATUS_OKAY</span><span class="p">:</span>
  387. <span class="k">return</span> <span class="n">socket_protocol</span><span class="o">.</span><span class="n">STATUS_OKAY</span><span class="p">,</span> <span class="n">time</span><span class="o">.</span><span class="n">asctime</span><span class="p">()</span>
  388. <span class="k">else</span><span class="p">:</span>
  389. <span class="k">return</span> <span class="n">socket_protocol</span><span class="o">.</span><span class="n">STATUS_OPERATION_NOT_PERMITTED</span><span class="p">,</span> <span class="kc">None</span>
  390. <span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s1">&#39;__main__&#39;</span><span class="p">:</span>
  391. <span class="n">report</span><span class="o">.</span><span class="n">stdoutLoggingConfigure</span><span class="p">(</span><span class="n">log_name_lvl</span><span class="o">=</span><span class="p">[(</span><span class="s1">&#39;root&#39;</span><span class="p">,</span> <span class="s1">&#39;INFO&#39;</span><span class="p">),</span> <span class="p">])</span>
  392. <span class="n">s</span> <span class="o">=</span> <span class="n">tcp_socket</span><span class="o">.</span><span class="n">tcp_server_stp</span><span class="p">(</span><span class="s1">&#39;127.0.0.1&#39;</span><span class="p">,</span> <span class="mi">17017</span><span class="p">)</span>
  393. <span class="n">sp</span> <span class="o">=</span> <span class="n">example_protocol</span><span class="p">(</span><span class="n">s</span><span class="p">,</span> <span class="n">channel_name</span><span class="o">=</span><span class="s1">&#39;example_server&#39;</span><span class="p">)</span>
  394. <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span>
  395. <span class="k">while</span> <span class="ow">not</span> <span class="n">s</span><span class="o">.</span><span class="n">is_connected</span><span class="p">()</span> <span class="ow">and</span> <span class="n">i</span> <span class="o">&lt;=</span> <span class="mi">20</span><span class="p">:</span>
  396. <span class="n">i</span> <span class="o">+=</span> <span class="mi">1</span>
  397. <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="o">.</span><span class="mi">1</span><span class="p">)</span> <span class="c1"># wait for a connection</span>
  398. <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span>
  399. <span class="k">while</span> <span class="n">s</span><span class="o">.</span><span class="n">is_connected</span><span class="p">()</span> <span class="ow">and</span> <span class="n">i</span> <span class="o">&lt;=</span> <span class="mi">20</span><span class="p">:</span>
  400. <span class="n">i</span> <span class="o">+=</span> <span class="mi">1</span>
  401. <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="o">.</span><span class="mi">1</span><span class="p">)</span> <span class="c1"># wait for disconnect</span>
  402. </pre></div>
  403. </div>
  404. <p>Will result to the following output:</p>
  405. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">12</span> <span class="mi">09</span><span class="p">:</span><span class="mi">13</span><span class="p">:</span><span class="mi">30</span><span class="p">,</span><span class="mi">657</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">socket_protocol</span><span class="o">.</span><span class="n">example_client</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">prot</span><span class="o">-</span><span class="n">client</span><span class="p">:</span> <span class="n">Resetting</span> <span class="n">authentification</span> <span class="n">state</span> <span class="n">to</span> <span class="n">AUTH_STATE_UNTRUSTED_CONNECTION</span>
  406. <span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">12</span> <span class="mi">09</span><span class="p">:</span><span class="mi">13</span><span class="p">:</span><span class="mi">30</span><span class="p">,</span><span class="mi">657</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">socket_protocol</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">prot</span><span class="o">-</span><span class="n">client</span><span class="p">:</span> <span class="n">Initialisation</span> <span class="n">finished</span><span class="o">.</span>
  407. <span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">12</span> <span class="mi">09</span><span class="p">:</span><span class="mi">13</span><span class="p">:</span><span class="mi">30</span><span class="p">,</span><span class="mi">657</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">socket_protocol</span><span class="o">.</span><span class="n">example_client</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">prot</span><span class="o">-</span><span class="n">client</span><span class="p">:</span> <span class="n">TX</span> <span class="o">-&gt;</span> <span class="n">service</span><span class="p">:</span> <span class="n">read</span> <span class="n">data</span> <span class="n">request</span><span class="p">,</span> <span class="n">data_id</span><span class="p">:</span> <span class="n">asc_time</span><span class="p">,</span> <span class="n">status</span><span class="p">:</span> <span class="n">okay</span><span class="p">,</span> <span class="n">data</span><span class="p">:</span> <span class="s2">&quot;None&quot;</span>
  408. <span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">12</span> <span class="mi">09</span><span class="p">:</span><span class="mi">13</span><span class="p">:</span><span class="mi">30</span><span class="p">,</span><span class="mi">708</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">example_client</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">comm</span><span class="o">-</span><span class="n">client</span><span class="p">:</span> <span class="n">Connection</span> <span class="n">established</span><span class="o">...</span> <span class="p">(</span><span class="n">to</span> <span class="mf">127.0</span><span class="o">.</span><span class="mf">0.1</span><span class="p">:</span><span class="mi">17017</span><span class="p">)</span>
  409. <span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">12</span> <span class="mi">09</span><span class="p">:</span><span class="mi">13</span><span class="p">:</span><span class="mi">30</span><span class="p">,</span><span class="mi">708</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">socket_protocol</span><span class="o">.</span><span class="n">example_client</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">prot</span><span class="o">-</span><span class="n">client</span><span class="p">:</span> <span class="n">TX</span> <span class="o">-&gt;</span> <span class="n">service</span><span class="p">:</span> <span class="n">channel</span> <span class="n">name</span> <span class="n">request</span><span class="p">,</span> <span class="n">data_id</span><span class="p">:</span> <span class="n">name</span><span class="p">,</span> <span class="n">status</span><span class="p">:</span> <span class="n">okay</span><span class="p">,</span> <span class="n">data</span><span class="p">:</span> <span class="s2">&quot;&#39;example_client&#39;&quot;</span>
  410. <span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">12</span> <span class="mi">09</span><span class="p">:</span><span class="mi">13</span><span class="p">:</span><span class="mi">30</span><span class="p">,</span><span class="mi">708</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">example_client</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">comm</span><span class="o">-</span><span class="n">client</span><span class="p">:</span> <span class="n">TX</span> <span class="o">-&gt;</span> <span class="s2">&quot;(74): 7b 22 64 61 74 61 5f 69 64 22 3a 20 30 2c 20 22 73 65 72 76 69 63 65 5f 69 64 22 3a 20 38 2c 20 22 73 74 61 74 75 73 22 3a 20 30 2c 20 22 64 61 74 61 22 3a 20 22 65 78 61 6d 70 6c 65 5f 63 6c 69 65 6e 74 22 7d f5 cd dd e7&quot;</span>
  411. <span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">12</span> <span class="mi">09</span><span class="p">:</span><span class="mi">13</span><span class="p">:</span><span class="mi">30</span><span class="p">,</span><span class="mi">758</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">example_client</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">comm</span><span class="o">-</span><span class="n">client</span><span class="p">:</span> <span class="n">TX</span> <span class="o">-&gt;</span> <span class="s2">&quot;(63): 7b 22 64 61 74 61 5f 69 64 22 3a 20 30 2c 20 22 73 65 72 76 69 63 65 5f 69 64 22 3a 20 31 30 2c 20 22 73 74 61 74 75 73 22 3a 20 30 2c 20 22 64 61 74 61 22 3a 20 6e 75 6c 6c 7d 45 05 7b b4&quot;</span>
  412. <span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">12</span> <span class="mi">09</span><span class="p">:</span><span class="mi">13</span><span class="p">:</span><span class="mi">30</span><span class="p">,</span><span class="mi">759</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">stringtools</span><span class="o">.</span><span class="n">stp</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">STP</span><span class="p">:</span> <span class="n">message</span> <span class="n">identified</span> <span class="o">-</span> <span class="p">(</span><span class="mi">62</span><span class="p">):</span> <span class="mi">7</span><span class="n">b</span> <span class="mi">22</span> <span class="mi">64</span> <span class="mi">61</span> <span class="mi">74</span> <span class="mi">61</span> <span class="mi">5</span><span class="n">f</span> <span class="mi">69</span> <span class="mi">64</span> <span class="mi">22</span> <span class="mi">3</span><span class="n">a</span> <span class="mi">20</span> <span class="mi">30</span> <span class="mi">2</span><span class="n">c</span> <span class="mi">20</span> <span class="mi">22</span> <span class="mi">73</span> <span class="mi">65</span> <span class="mi">72</span> <span class="mi">76</span> <span class="mi">69</span> <span class="mi">63</span> <span class="mi">65</span> <span class="mi">5</span><span class="n">f</span> <span class="mi">69</span> <span class="mi">64</span> <span class="mi">22</span> <span class="mi">3</span><span class="n">a</span> <span class="mi">20</span> <span class="mi">39</span> <span class="mi">2</span><span class="n">c</span> <span class="mi">20</span> <span class="mi">22</span> <span class="mi">73</span> <span class="mi">74</span> <span class="mi">61</span> <span class="mi">74</span> <span class="mi">75</span> <span class="mi">73</span> <span class="mi">22</span> <span class="mi">3</span><span class="n">a</span> <span class="mi">20</span> <span class="mi">30</span> <span class="mi">2</span><span class="n">c</span> <span class="mi">20</span> <span class="mi">22</span> <span class="mi">64</span> <span class="mi">61</span> <span class="mi">74</span> <span class="mi">61</span> <span class="mi">22</span> <span class="mi">3</span><span class="n">a</span> <span class="mi">20</span> <span class="mi">6</span><span class="n">e</span> <span class="mi">75</span> <span class="mi">6</span><span class="n">c</span> <span class="mi">6</span><span class="n">c</span> <span class="mi">7</span><span class="n">d</span> <span class="mi">30</span> <span class="mi">59</span> <span class="n">be</span> <span class="mi">2</span><span class="n">f</span>
  413. <span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">12</span> <span class="mi">09</span><span class="p">:</span><span class="mi">13</span><span class="p">:</span><span class="mi">30</span><span class="p">,</span><span class="mi">760</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">example_client</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">comm</span><span class="o">-</span><span class="n">client</span><span class="p">:</span> <span class="n">RX</span> <span class="o">&lt;-</span> <span class="s2">&quot;(62): 7b 22 64 61 74 61 5f 69 64 22 3a 20 30 2c 20 22 73 65 72 76 69 63 65 5f 69 64 22 3a 20 39 2c 20 22 73 74 61 74 75 73 22 3a 20 30 2c 20 22 64 61 74 61 22 3a 20 6e 75 6c 6c 7d 30 59 be 2f&quot;</span>
  414. <span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">12</span> <span class="mi">09</span><span class="p">:</span><span class="mi">13</span><span class="p">:</span><span class="mi">30</span><span class="p">,</span><span class="mi">760</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">socket_protocol</span><span class="o">.</span><span class="n">example_client</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">prot</span><span class="o">-</span><span class="n">client</span><span class="p">:</span> <span class="n">RX</span> <span class="o">&lt;-</span> <span class="n">service</span><span class="p">:</span> <span class="n">channel</span> <span class="n">name</span> <span class="n">response</span><span class="p">,</span> <span class="n">data_id</span><span class="p">:</span> <span class="n">name</span><span class="p">,</span> <span class="n">status</span><span class="p">:</span> <span class="n">okay</span><span class="p">,</span> <span class="n">data</span><span class="p">:</span> <span class="s2">&quot;None&quot;</span>
  415. <span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">12</span> <span class="mi">09</span><span class="p">:</span><span class="mi">13</span><span class="p">:</span><span class="mi">30</span><span class="p">,</span><span class="mi">811</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">stringtools</span><span class="o">.</span><span class="n">stp</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">STP</span><span class="p">:</span> <span class="n">message</span> <span class="n">identified</span> <span class="o">-</span> <span class="p">(</span><span class="mi">85</span><span class="p">):</span> <span class="mi">7</span><span class="n">b</span> <span class="mi">22</span> <span class="mi">64</span> <span class="mi">61</span> <span class="mi">74</span> <span class="mi">61</span> <span class="mi">5</span><span class="n">f</span> <span class="mi">69</span> <span class="mi">64</span> <span class="mi">22</span> <span class="mi">3</span><span class="n">a</span> <span class="mi">20</span> <span class="mi">30</span> <span class="mi">2</span><span class="n">c</span> <span class="mi">20</span> <span class="mi">22</span> <span class="mi">73</span> <span class="mi">65</span> <span class="mi">72</span> <span class="mi">76</span> <span class="mi">69</span> <span class="mi">63</span> <span class="mi">65</span> <span class="mi">5</span><span class="n">f</span> <span class="mi">69</span> <span class="mi">64</span> <span class="mi">22</span> <span class="mi">3</span><span class="n">a</span> <span class="mi">20</span> <span class="mi">31</span> <span class="mi">31</span> <span class="mi">2</span><span class="n">c</span> <span class="mi">20</span> <span class="mi">22</span> <span class="mi">73</span> <span class="mi">74</span> <span class="mi">61</span> <span class="mi">74</span> <span class="mi">75</span> <span class="mi">73</span> <span class="mi">22</span> <span class="mi">3</span><span class="n">a</span> <span class="mi">20</span> <span class="mi">30</span> <span class="mi">2</span><span class="n">c</span> <span class="mi">20</span> <span class="mi">22</span> <span class="mi">64</span> <span class="mi">61</span> <span class="mi">74</span> <span class="mi">61</span> <span class="mi">22</span> <span class="mi">3</span><span class="n">a</span> <span class="mi">20</span> <span class="mi">22</span> <span class="mi">54</span> <span class="mi">75</span> <span class="mi">65</span> <span class="mi">20</span> <span class="mi">4</span><span class="n">a</span> <span class="mi">61</span> <span class="mi">6</span><span class="n">e</span> <span class="mi">20</span> <span class="mi">31</span> <span class="mi">32</span> <span class="mi">20</span> <span class="mi">30</span> <span class="mi">39</span> <span class="mi">3</span><span class="n">a</span> <span class="mi">31</span> <span class="mi">33</span> <span class="mi">3</span><span class="n">a</span> <span class="mi">33</span> <span class="mi">30</span> <span class="mi">20</span> <span class="mi">32</span> <span class="mi">30</span> <span class="mi">32</span> <span class="mi">31</span> <span class="mi">22</span> <span class="mi">7</span><span class="n">d</span> <span class="mi">2</span><span class="n">b</span> <span class="n">b5</span> <span class="n">b2</span> <span class="mi">77</span>
  416. <span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">12</span> <span class="mi">09</span><span class="p">:</span><span class="mi">13</span><span class="p">:</span><span class="mi">30</span><span class="p">,</span><span class="mi">812</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">example_client</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">comm</span><span class="o">-</span><span class="n">client</span><span class="p">:</span> <span class="n">RX</span> <span class="o">&lt;-</span> <span class="s2">&quot;(85): 7b 22 64 61 74 61 5f 69 64 22 3a 20 30 2c 20 22 73 65 72 76 69 63 65 5f 69 64 22 3a 20 31 31 2c 20 22 73 74 61 74 75 73 22 3a 20 30 2c 20 22 64 61 74 61 22 3a 20 22 54 75 65 20 4a 61 6e 20 31 32 20 30 39 3a 31 33 3a 33 30 20 32 30 32 31 22 7d 2b b5 b2 77&quot;</span>
  417. <span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">12</span> <span class="mi">09</span><span class="p">:</span><span class="mi">13</span><span class="p">:</span><span class="mi">30</span><span class="p">,</span><span class="mi">812</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">socket_protocol</span><span class="o">.</span><span class="n">example_client</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">prot</span><span class="o">-</span><span class="n">client</span><span class="p">:</span> <span class="n">RX</span> <span class="o">&lt;-</span> <span class="n">service</span><span class="p">:</span> <span class="n">read</span> <span class="n">data</span> <span class="n">response</span><span class="p">,</span> <span class="n">data_id</span><span class="p">:</span> <span class="n">asc_time</span><span class="p">,</span> <span class="n">status</span><span class="p">:</span> <span class="n">okay</span><span class="p">,</span> <span class="n">data</span><span class="p">:</span> <span class="s2">&quot;&#39;Tue Jan 12 09:13:30 2021&#39;&quot;</span>
  418. <span class="n">The</span> <span class="n">Client</span> <span class="n">received</span><span class="p">:</span> <span class="s1">&#39;Tue Jan 12 09:13:30 2021&#39;</span>
  419. </pre></div>
  420. </div>
  421. <dl class="method">
  422. <dt id="socket_protocol.pure_json_protocol.add_data">
  423. <code class="descname">add_data</code><span class="sig-paren">(</span><em>service_id</em>, <em>data_id</em>, <em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#socket_protocol.pure_json_protocol.add_data" title="Permalink to this definition">¶</a></dt>
  424. <dd><p>Method to add a name for a specific message.</p>
  425. <table class="docutils field-list" frame="void" rules="none">
  426. <col class="field-name" />
  427. <col class="field-body" />
  428. <tbody valign="top">
  429. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
  430. <li><strong>service_id</strong> (<em>int</em><em> or </em><em>list of ints</em>) – The Service-ID of the message. See class definitions starting with <code class="docutils literal notranslate"><span class="pre">SID_</span></code>.</li>
  431. <li><strong>data_id</strong> (<em>int</em>) – The Data-ID of the message.</li>
  432. <li><strong>name</strong> (<em>str</em>) – The Name for the transfered message.</li>
  433. </ul>
  434. </td>
  435. </tr>
  436. </tbody>
  437. </table>
  438. </dd></dl>
  439. <dl class="method">
  440. <dt id="socket_protocol.pure_json_protocol.add_msg_to_auth_whitelist_">
  441. <code class="descname">add_msg_to_auth_whitelist_</code><span class="sig-paren">(</span><em>service_id</em>, <em>data_id</em><span class="sig-paren">)</span><a class="headerlink" href="#socket_protocol.pure_json_protocol.add_msg_to_auth_whitelist_" title="Permalink to this definition">¶</a></dt>
  442. <dd><p>Method to add a specific message to the list, where no authentification is required.</p>
  443. <table class="docutils field-list" frame="void" rules="none">
  444. <col class="field-name" />
  445. <col class="field-body" />
  446. <tbody valign="top">
  447. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
  448. <li><strong>service_id</strong> (<em>int</em>) – The Service-ID of the message. See class definitions starting with <code class="docutils literal notranslate"><span class="pre">SID_</span></code>.</li>
  449. <li><strong>data_id</strong> (<em>int</em>) – The Data-ID of the message.</li>
  450. </ul>
  451. </td>
  452. </tr>
  453. </tbody>
  454. </table>
  455. </dd></dl>
  456. <dl class="method">
  457. <dt id="socket_protocol.pure_json_protocol.add_service">
  458. <code class="descname">add_service</code><span class="sig-paren">(</span><em>req_sid</em>, <em>resp_sid</em>, <em>req_name=None</em>, <em>resp_name=None</em><span class="sig-paren">)</span><a class="headerlink" href="#socket_protocol.pure_json_protocol.add_service" title="Permalink to this definition">¶</a></dt>
  459. <dd><p>Method to add a Service defined by Request- and Response Serivce-ID.</p>
  460. <table class="docutils field-list" frame="void" rules="none">
  461. <col class="field-name" />
  462. <col class="field-body" />
  463. <tbody valign="top">
  464. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
  465. <li><strong>req_sid</strong> (<em>int</em>) – The Request Service-ID.</li>
  466. <li><strong>resp_sid</strong> (<em>int</em>) – The Response Service-ID.</li>
  467. </ul>
  468. </td>
  469. </tr>
  470. </tbody>
  471. </table>
  472. </dd></dl>
  473. <dl class="method">
  474. <dt id="socket_protocol.pure_json_protocol.add_status">
  475. <code class="descname">add_status</code><span class="sig-paren">(</span><em>status</em>, <em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#socket_protocol.pure_json_protocol.add_status" title="Permalink to this definition">¶</a></dt>
  476. <dd><p>Method to add a name for a status.</p>
  477. <table class="docutils field-list" frame="void" rules="none">
  478. <col class="field-name" />
  479. <col class="field-body" />
  480. <tbody valign="top">
  481. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
  482. <li><strong>status</strong> (<em>int</em>) – The Status. See class definitions starting with <code class="docutils literal notranslate"><span class="pre">STATUS_</span></code>.</li>
  483. <li><strong>name</strong> (<em>str</em>) – The Name for the Status.</li>
  484. </ul>
  485. </td>
  486. </tr>
  487. </tbody>
  488. </table>
  489. </dd></dl>
  490. <dl class="method">
  491. <dt id="socket_protocol.pure_json_protocol.authentificate">
  492. <code class="descname">authentificate</code><span class="sig-paren">(</span><em>timeout=2</em><span class="sig-paren">)</span><a class="headerlink" href="#socket_protocol.pure_json_protocol.authentificate" title="Permalink to this definition">¶</a></dt>
  493. <dd><p>This method authetificates the client at the server.</p>
  494. <table class="docutils field-list" frame="void" rules="none">
  495. <col class="field-name" />
  496. <col class="field-body" />
  497. <tbody valign="top">
  498. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>timeout</strong> (<em>float</em>) – The timeout for the authentification (requesting seed, sending key and getting authentification_feedback).</td>
  499. </tr>
  500. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">True, if authentification was successfull; False, if not.</td>
  501. </tr>
  502. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
  503. </tr>
  504. </tbody>
  505. </table>
  506. <div class="admonition note">
  507. <p class="first admonition-title">Note</p>
  508. <p class="last">An authentification will only processed, if a secret had been given on initialisation.</p>
  509. </div>
  510. <div class="admonition note">
  511. <p class="first admonition-title">Note</p>
  512. <p class="last">Client and Server needs to use the same secret.</p>
  513. </div>
  514. </dd></dl>
  515. <dl class="method">
  516. <dt id="socket_protocol.pure_json_protocol.check_authentification_state">
  517. <code class="descname">check_authentification_state</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#socket_protocol.pure_json_protocol.check_authentification_state" title="Permalink to this definition">¶</a></dt>
  518. <dd><p>This Method return the Authitification State as boolean value.</p>
  519. <table class="docutils field-list" frame="void" rules="none">
  520. <col class="field-name" />
  521. <col class="field-body" />
  522. <tbody valign="top">
  523. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">True, if authentification state is okay, otherwise False</td>
  524. </tr>
  525. <tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
  526. </tr>
  527. </tbody>
  528. </table>
  529. </dd></dl>
  530. <dl class="method">
  531. <dt id="socket_protocol.pure_json_protocol.connection_established">
  532. <code class="descname">connection_established</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#socket_protocol.pure_json_protocol.connection_established" title="Permalink to this definition">¶</a></dt>
  533. <dd><p>This Method returns the Connection state including authentification as a boolean value.</p>
  534. <table class="docutils field-list" frame="void" rules="none">
  535. <col class="field-name" />
  536. <col class="field-body" />
  537. <tbody valign="top">
  538. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">True, if the connection is established (incl. authentification, if a secret has been given)</td>
  539. </tr>
  540. <tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
  541. </tr>
  542. </tbody>
  543. </table>
  544. </dd></dl>
  545. <dl class="method">
  546. <dt id="socket_protocol.pure_json_protocol.is_connected">
  547. <code class="descname">is_connected</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#socket_protocol.pure_json_protocol.is_connected" title="Permalink to this definition">¶</a></dt>
  548. <dd><p>This Methods returns Connection state of the Communication Instance <code class="xref py py-func docutils literal notranslate"><span class="pre">comm_instance.is_connected()</span></code>.</p>
  549. <table class="docutils field-list" frame="void" rules="none">
  550. <col class="field-name" />
  551. <col class="field-body" />
  552. <tbody valign="top">
  553. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">True if the <code class="xref py py-class docutils literal notranslate"><span class="pre">comm_instance</span></code> is connected, otherwise False..</td>
  554. </tr>
  555. <tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
  556. </tr>
  557. </tbody>
  558. </table>
  559. </dd></dl>
  560. <dl class="method">
  561. <dt id="socket_protocol.pure_json_protocol.receive">
  562. <code class="descname">receive</code><span class="sig-paren">(</span><em>service_id</em>, <em>data_id</em>, <em>timeout=1</em><span class="sig-paren">)</span><a class="headerlink" href="#socket_protocol.pure_json_protocol.receive" title="Permalink to this definition">¶</a></dt>
  563. <dd><p>This Method returns a message object for a defined message or None, if this message is not available after the given timout.</p>
  564. <table class="docutils field-list" frame="void" rules="none">
  565. <col class="field-name" />
  566. <col class="field-body" />
  567. <tbody valign="top">
  568. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  569. <li><strong>service_id</strong> (<em>int</em>) – The Service-ID for the message. See class definitions starting with <code class="docutils literal notranslate"><span class="pre">SID_</span></code>.</li>
  570. <li><strong>data_id</strong> (<em>int</em>) – The Data-ID for the message.</li>
  571. <li><strong>timeout</strong> (<em>float</em>) – The timeout for receiving.</li>
  572. </ul>
  573. </td>
  574. </tr>
  575. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The received data storage object or None, if no data was received.</p>
  576. </td>
  577. </tr>
  578. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#socket_protocol.data_storage" title="socket_protocol.data_storage">data_storage</a></p>
  579. </td>
  580. </tr>
  581. </tbody>
  582. </table>
  583. </dd></dl>
  584. <dl class="method">
  585. <dt id="socket_protocol.pure_json_protocol.reconnect">
  586. <code class="descname">reconnect</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#socket_protocol.pure_json_protocol.reconnect" title="Permalink to this definition">¶</a></dt>
  587. <dd><p>This methods initiates a reconnect by calling <code class="xref py py-func docutils literal notranslate"><span class="pre">comm_instance.reconnect()</span></code>.</p>
  588. </dd></dl>
  589. <dl class="method">
  590. <dt id="socket_protocol.pure_json_protocol.register_callback">
  591. <code class="descname">register_callback</code><span class="sig-paren">(</span><em>service_id</em>, <em>data_id</em>, <em>callback</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#socket_protocol.pure_json_protocol.register_callback" title="Permalink to this definition">¶</a></dt>
  592. <dd><p>This method registers a callback for the given parameters. Giving <code class="docutils literal notranslate"><span class="pre">None</span></code> means, that all Service-IDs or all Data-IDs are used.
  593. If a message hitting these parameters has been received, the callback will be executed.</p>
  594. <table class="docutils field-list" frame="void" rules="none">
  595. <col class="field-name" />
  596. <col class="field-body" />
  597. <tbody valign="top">
  598. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
  599. <li><strong>service_id</strong> (<em>int</em>) – The Service-ID for the message. See class definitions starting with <code class="docutils literal notranslate"><span class="pre">SID_</span></code>.</li>
  600. <li><strong>data_id</strong> (<em>int</em>) – The Data-ID for the message.</li>
  601. </ul>
  602. </td>
  603. </tr>
  604. </tbody>
  605. </table>
  606. <div class="admonition note">
  607. <p class="first admonition-title">Note</p>
  608. <p>The <code class="xref py py-func docutils literal notranslate"><span class="pre">callback()</span></code> is priorised in the following order:</p>
  609. <ul class="last simple">
  610. <li>Callbacks with defined Service-ID and Data-ID.</li>
  611. <li>Callbacks with a defined Service-ID and all Data-IDs.</li>
  612. <li>Callbacks with a defined Data-ID and all Service-IDs.</li>
  613. <li>Unspecific Callbacks.</li>
  614. </ul>
  615. </div>
  616. <div class="admonition note">
  617. <p class="first admonition-title">Note</p>
  618. <p>The <code class="xref py py-func docutils literal notranslate"><span class="pre">callback()</span></code> is executed with these arguments:</p>
  619. <p><strong>Parameters given at the callback call:</strong></p>
  620. <ul class="simple">
  621. <li>The first Arguments is the received message as <a class="reference internal" href="#socket_protocol.data_storage" title="socket_protocol.data_storage"><code class="xref py py-class docutils literal notranslate"><span class="pre">data_storage</span></code></a> object.</li>
  622. <li>Further arguments given at registration.</li>
  623. <li>Further keyword arguments given at registration.</li>
  624. </ul>
  625. <p><strong>Return value of the callback:</strong></p>
  626. <p>If the Callback is a Request Callback for a registered Service, the return value has to be a tuple or list with</p>
  627. <ul class="last simple">
  628. <li><code class="xref py py-const docutils literal notranslate"><span class="pre">response_status</span></code>: The response status (see class definitions starting with <code class="xref py py-const docutils literal notranslate"><span class="pre">STA_*</span></code>.</li>
  629. <li><code class="xref py py-const docutils literal notranslate"><span class="pre">response_data</span></code>: A JSON iterable object to be used as data for the response.</li>
  630. </ul>
  631. </div>
  632. <div class="admonition note">
  633. <p class="first admonition-title">Note</p>
  634. <p class="last">Only registered services will respond via the callbacks return values with the same data_id.</p>
  635. </div>
  636. </dd></dl>
  637. <dl class="method">
  638. <dt id="socket_protocol.pure_json_protocol.send">
  639. <code class="descname">send</code><span class="sig-paren">(</span><em>service_id</em>, <em>data_id</em>, <em>data</em>, <em>status=0</em>, <em>timeout=2</em><span class="sig-paren">)</span><a class="headerlink" href="#socket_protocol.pure_json_protocol.send" title="Permalink to this definition">¶</a></dt>
  640. <dd><p>This methods sends out a message with the given content.</p>
  641. <table class="docutils field-list" frame="void" rules="none">
  642. <col class="field-name" />
  643. <col class="field-body" />
  644. <tbody valign="top">
  645. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  646. <li><strong>service_id</strong> (<em>int</em>) – The Service-ID for the message. See class definitions starting with <code class="docutils literal notranslate"><span class="pre">SERVICE_</span></code>.</li>
  647. <li><strong>data_id</strong> (<em>int</em>) – The Data-ID for the message.</li>
  648. <li><strong>data</strong> (<em>str</em>) – The data to be transfered. The data needs to be json compatible.</li>
  649. <li><strong>status</strong> (<em>int</em>) – The Status for the message. All requests should have <code class="docutils literal notranslate"><span class="pre">STATUS_OKAY</span></code>.</li>
  650. <li><strong>timeout</strong> (<em>float</em>) – The timeout for sending data (e.g. time to establish new connection).</li>
  651. </ul>
  652. </td>
  653. </tr>
  654. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">True if data had been sent, otherwise False.</p>
  655. </td>
  656. </tr>
  657. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p>
  658. </td>
  659. </tr>
  660. </tbody>
  661. </table>
  662. </dd></dl>
  663. </dd></dl>
  664. <dl class="class">
  665. <dt id="socket_protocol.struct_json_protocol">
  666. <em class="property">class </em><code class="descclassname">socket_protocol.</code><code class="descname">struct_json_protocol</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#socket_protocol.struct_json_protocol" title="Permalink to this definition">¶</a></dt>
  667. <dd><p>This Class has the same functionality like <a class="reference internal" href="#socket_protocol.pure_json_protocol" title="socket_protocol.pure_json_protocol"><code class="xref py py-class docutils literal notranslate"><span class="pre">pure_json_protocol</span></code></a>. The message length is less than for <a class="reference internal" href="#socket_protocol.pure_json_protocol" title="socket_protocol.pure_json_protocol"><code class="xref py py-class docutils literal notranslate"><span class="pre">pure_json_protocol</span></code></a>, but the functionality and compatibility is reduced.
  668. See also parent <a class="reference internal" href="#socket_protocol.pure_json_protocol" title="socket_protocol.pure_json_protocol"><code class="xref py py-class docutils literal notranslate"><span class="pre">pure_json_protocol</span></code></a>.</p>
  669. <div class="admonition note">
  670. <p class="first admonition-title">Note</p>
  671. <p class="last">This class is depreceated and here for compatibility reasons (to support old clients or servers). Usage of <a class="reference internal" href="#socket_protocol.pure_json_protocol" title="socket_protocol.pure_json_protocol"><code class="xref py py-class docutils literal notranslate"><span class="pre">pure_json_protocol</span></code></a> is recommended.</p>
  672. </div>
  673. </dd></dl>
  674. </div>
  675. <div class="toctree-wrapper compound">
  676. </div>
  677. </div>
  678. <div class="section" id="indices-and-tables">
  679. <h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Permalink to this headline">¶</a></h1>
  680. <ul class="simple">
  681. <li><a class="reference internal" href="genindex.html"><span class="std std-ref">Index</span></a></li>
  682. <li><a class="reference internal" href="py-modindex.html"><span class="std std-ref">Module Index</span></a></li>
  683. <li><a class="reference internal" href="search.html"><span class="std std-ref">Search Page</span></a></li>
  684. </ul>
  685. </div>
  686. </div>
  687. </div>
  688. <footer>
  689. <hr/>
  690. <div role="contentinfo">
  691. <p>
  692. &copy; Copyright 2021, Dirk Alders
  693. </p>
  694. </div>
  695. Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a
  696. <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a>
  697. provided by <a href="https://readthedocs.org">Read the Docs</a>.
  698. </footer>
  699. </div>
  700. </div>
  701. </section>
  702. </div>
  703. <script type="text/javascript">
  704. jQuery(function () {
  705. SphinxRtdTheme.Navigation.enable(true);
  706. });
  707. </script>
  708. </body>
  709. </html>