app/assets/dev_api_comm_socks_channel.md.CeeqClw3.js

27 lines
8.5 KiB
JavaScript
Raw Normal View History

import{_ as s,c as a,o as i,a4 as n}from"./chunks/framework.BZiUP1E-.js";const u=JSON.parse('{"title":"liteyuki.comm.socks_channel","description":"","frontmatter":{"title":"liteyuki.comm.socks_channel"},"headers":[],"relativePath":"dev/api/comm/socks_channel.md","filePath":"zh/dev/api/comm/socks_channel.md","lastUpdated":null}'),e={name:"dev/api/comm/socks_channel.md"},t=n(`<h1 id="liteyuki-comm-socks-channel" tabindex="-1">liteyuki.comm.socks_channel <a class="header-anchor" href="#liteyuki-comm-socks-channel" aria-label="Permalink to &quot;liteyuki.comm.socks_channel&quot;"></a></h1><p><strong>说明</strong>: 基于socket的通道</p><h3 id="class-sockschannel" tabindex="-1"><em><strong>class</strong></em> <code>SocksChannel</code> <a class="header-anchor" href="#class-sockschannel" aria-label="Permalink to &quot;***class*** \`SocksChannel\`&quot;"></a></h3><h4 id="def-init-self-name-str" tabindex="-1"><em><strong>def</strong></em> <code>__init__(self, name: str)</code> <a class="header-anchor" href="#def-init-self-name-str" aria-label="Permalink to &quot;***def*** \`__init__(self, name: str)\`&quot;"></a></h4><p><strong>说明</strong>: 初始化通道</p><p><strong>参数</strong>:</p><blockquote><ul><li>name: 通道ID</li></ul></blockquote><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/LiteyukiBot/tree/main/liteyuki/comm/socks_channel.py#L13" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> __init__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, name: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;&quot;&quot;</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 初始化通道</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> Args:</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> name: 通道ID</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;&quot;&quot;</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">._name </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> name</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">._conn_send </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> None</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">._conn_recv </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> None</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">._closed </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> False</span></span></code></pre></div></details><h4 id="def-send-self-data" tabindex="-1"><em><strong>def</strong></em> <code>send(self, data)</code> <a class="header-anchor" href="#def-send-self-data" aria-label="Permalink to &quot;***def*** \`send(self, data)\`&quot;"></a></h4><p><strong></strong>: </p><p><strong></strong>:</p><blockquote><ul><li>data: </li></ul></blockquote><details><summary><b></b> <a href="https://github.com/LiteyukiStudio/LiteyukiBot/tree/main/liteyuki/comm/socks_channel.py#L25" target="_blank">GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> send</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, data):</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;&quot;&quot;</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 发送数据</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> Args:</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> data: 数据</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;&quot;&quot;</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> pass</span></span></code></pre></div></details><h4 id="def-receive-self" tabindex="-1"><em><strong>def</strong></em> <code>receive(self)</code> <a class="header-anchor" href="#def-receive-self" aria-label="Permalink to &quot;***def*** \`receive(self)\`&quot;"></a></h4><p><strong></strong>: </p><p><strong></strong>: data: </p><details><summary><b></b> <a href="https://github.com/LiteyukiStudio/LiteyukiBot/tree/main/liteyuki/comm/socks_channel.py#L34" target="_blank">GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> receive</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self):</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;&quot;&quot;</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 接收数据</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> Returns:</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> data: 数据</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;&quot;&quot;</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> pass</span></span></code></pre></div></details><h4 id="def-close-self" tabindex="-1"><em><strong>def</strong></em> <code>close(self)</code> <a class="header-anchor" href="#def-close-self" aria-label="Permalink to &quot;***def*** \`close(self)\`&quot;"></a></h4><p><strong></strong>: </p><details><summary><b></b> <a href="https://github.com/LiteyukiStudio/LiteyukiBot/tree/main/liteyuki/comm/socks_channel.py#L43" target="_blank">GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> close</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self):</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;&quot;&quot;</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 关闭通道</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;&quot;&quot;</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> pass</span></span></code></pre></div></details>`,20),l=[t];function h(p,k,o,d,c,r){return i(),a("div",null,l)}const y=s(e,[["render",h]]);export{u as __pageData,y as default};