bitmessage-js/docs/module-bitmessage_net_base....

881 lines
12 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: BaseTransport</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: BaseTransport</h1>
<section>
<header>
<h2>
<span class="ancestors"><a href="module-bitmessage_net_base.html">bitmessage/net/base</a>.</span>
BaseTransport
</h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="BaseTransport"><span class="type-signature"></span>new BaseTransport<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Base transport class. Allows to use single class for both client and
server modes (as separate instances).</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="net_base.js.html">net/base.js</a>, <a href="net_base.js.html#line24">line 24</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="bootstrap"><span class="type-signature">(abstract) </span>bootstrap<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;Array>}</span></h4>
<div class="description">
<p>Do the transport-specific bootstrap process and return promise that
contains discovered nodes when fulfilled (both modes).<br>NOTE: Do not use nodes received by this method in <code>addr</code> messages!
This is meaningless.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="net_base.js.html">net/base.js</a>, <a href="net_base.js.html#line38">line 38</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Array></span>
</dd>
</dl>
<h4 class="name" id="broadcast"><span class="type-signature">(abstract) </span>broadcast<span class="signature">(msg, payload<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Send <a href="module-bitmessage_structs.message.html">message</a> to all
connected clients (server mode only).</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>msg</code></td>
<td class="type">
<span class="param-type">Buffer</span>
|
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Encoded message or command string</p></td>
</tr>
<tr>
<td class="name"><code>payload</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Message payload (used if the first
argument is a string)</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="net_base.js.html">net/base.js</a>, <a href="net_base.js.html#line82">line 82</a>
</li></ul></dd>
</dl>
<h4 class="name" id="close"><span class="type-signature">(abstract) </span>close<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Close connection(s) and/or stop listening (both modes).</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="net_base.js.html">net/base.js</a>, <a href="net_base.js.html#line90">line 90</a>
</li></ul></dd>
</dl>
<h4 class="name" id="connect"><span class="type-signature">(abstract) </span>connect<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Connect to the transport-specific address. Enters client mode. Should
emit <code>open</code> event after successful connect and <code>established</code> event
after <code>verack</code> messages exchange.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="net_base.js.html">net/base.js</a>, <a href="net_base.js.html#line48">line 48</a>
</li></ul></dd>
</dl>
<h4 class="name" id="listen"><span class="type-signature">(abstract) </span>listen<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Listen for the transport-specific incoming connections. Enters server
mode. Should emit <code>connection</code> event with a transport instance for
each new connection.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="net_base.js.html">net/base.js</a>, <a href="net_base.js.html#line58">line 58</a>
</li></ul></dd>
</dl>
<h4 class="name" id="send"><span class="type-signature">(abstract) </span>send<span class="signature">(msg, payload<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Send <a href="module-bitmessage_structs.message.html">message</a> over the
wire (client mode only).</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>msg</code></td>
<td class="type">
<span class="param-type">Buffer</span>
|
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Encoded message or command string</p></td>
</tr>
<tr>
<td class="name"><code>payload</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Message payload (used if the first
argument is a string)</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="net_base.js.html">net/base.js</a>, <a href="net_base.js.html#line70">line 70</a>
</li></ul></dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Sat Feb 14 2015 14:05:38 GMT+0300 (MSK)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>