UNPKG

actionhero

Version:

actionhero.js is a multi-transport API Server with integrated cluster capabilities and delayed tasks

784 lines (783 loc) 96.6 kB
<!doctype html> <html class="default no-js"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Server | actionhero</title> <meta name="description" content="Documentation for actionhero"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="../assets/css/main.css"> </head> <body> <header> <div class="tsd-page-toolbar"> <div class="container"> <div class="table-wrap"> <div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base=".."> <div class="field"> <label for="tsd-search-field" class="tsd-widget search no-caption">Search</label> <input id="tsd-search-field" type="text" /> </div> <ul class="results"> <li class="state loading">Preparing search index...</li> <li class="state failure">The search index is not available</li> </ul> <a href="../index.html" class="title">actionhero</a> </div> <div class="table-cell" id="tsd-widgets"> <div id="tsd-filter"> <a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a> <div class="tsd-filter-group"> <div class="tsd-select" id="tsd-filter-visibility"> <span class="tsd-select-label">All</span> <ul class="tsd-select-list"> <li data-value="public">Public</li> <li data-value="protected">Public/Protected</li> <li data-value="private" class="selected">All</li> </ul> </div> <input type="checkbox" id="tsd-filter-inherited" checked /> <label class="tsd-widget" for="tsd-filter-inherited">Inherited</label> <input type="checkbox" id="tsd-filter-externals" checked /> <label class="tsd-widget" for="tsd-filter-externals">Externals</label> <input type="checkbox" id="tsd-filter-only-exported" /> <label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label> </div> </div> <a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a> </div> </div> </div> </div> <div class="tsd-page-title"> <div class="container"> <ul class="tsd-breadcrumb"> <li> <a href="../globals.html">Globals</a> </li> <li> <a href="server.html">Server</a> </li> </ul> <h1>Class Server</h1> </div> </div> </header> <div class="container container-main"> <div class="row"> <div class="col-8 col-content"> <section class="tsd-panel tsd-comment"> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Create a new Actionhero Server. The required properties of an server. These can be defined statically (this.name) or as methods which return a value.</p> </div> </div> </section> <section class="tsd-panel tsd-hierarchy"> <h3>Hierarchy</h3> <ul class="tsd-hierarchy"> <li> <span class="tsd-signature-type">EventEmitter</span> <ul class="tsd-hierarchy"> <li> <span class="target">Server</span> <ul class="tsd-hierarchy"> <li> <a href="webserver.html" class="tsd-signature-type">WebServer</a> </li> <li> <a href="websocketserver.html" class="tsd-signature-type">WebSocketServer</a> </li> </ul> </li> </ul> </li> </ul> </section> <section class="tsd-panel-group tsd-index-group"> <h2>Index</h2> <section class="tsd-panel tsd-index-panel"> <div class="tsd-index-content"> <section class="tsd-index-section "> <h3>Constructors</h3> <ul class="tsd-index-list"> <li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite"><a href="server.html#constructor" class="tsd-kind-icon">constructor</a></li> </ul> </section> <section class="tsd-index-section "> <h3>Properties</h3> <ul class="tsd-index-list"> <li class="tsd-kind-property tsd-parent-kind-class"><a href="server.html#attributes" class="tsd-kind-icon">attributes</a></li> <li class="tsd-kind-property tsd-parent-kind-class"><a href="server.html#canchat" class="tsd-kind-icon">can<wbr>Chat</a></li> <li class="tsd-kind-property tsd-parent-kind-class"><a href="server.html#config" class="tsd-kind-icon">config</a></li> <li class="tsd-kind-property tsd-parent-kind-class"><a href="server.html#connectioncustommethods" class="tsd-kind-icon">connection<wbr>Custom<wbr>Methods</a></li> <li class="tsd-kind-property tsd-parent-kind-class"><a href="server.html#logconnections" class="tsd-kind-icon">log<wbr>Connections</a></li> <li class="tsd-kind-property tsd-parent-kind-class"><a href="server.html#logexits" class="tsd-kind-icon">log<wbr>Exits</a></li> <li class="tsd-kind-property tsd-parent-kind-class"><a href="server.html#options" class="tsd-kind-icon">options</a></li> <li class="tsd-kind-property tsd-parent-kind-class"><a href="server.html#sendwelcomemessage" class="tsd-kind-icon">send<wbr>Welcome<wbr>Message</a></li> <li class="tsd-kind-property tsd-parent-kind-class"><a href="server.html#server-1" class="tsd-kind-icon">server</a></li> <li class="tsd-kind-property tsd-parent-kind-class"><a href="server.html#type" class="tsd-kind-icon">type</a></li> <li class="tsd-kind-property tsd-parent-kind-class"><a href="server.html#verbs" class="tsd-kind-icon">verbs</a></li> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static"><a href="server.html#defaultmaxlisteners" class="tsd-kind-icon">default<wbr>Max<wbr>Listeners</a></li> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static"><a href="server.html#errormonitor" class="tsd-kind-icon">error<wbr>Monitor</a></li> </ul> </section> <section class="tsd-index-section "> <h3>Methods</h3> <ul class="tsd-index-list"> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="server.html#addlistener" class="tsd-kind-icon">add<wbr>Listener</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="server.html#buildconnection" class="tsd-kind-icon">build<wbr>Connection</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="server.html#connections" class="tsd-kind-icon">connections</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="server.html#defaultattributes" class="tsd-kind-icon">default<wbr>Attributes</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="server.html#emit" class="tsd-kind-icon">emit</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="server.html#eventnames" class="tsd-kind-icon">event<wbr>Names</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="server.html#getmaxlisteners" class="tsd-kind-icon">get<wbr>Max<wbr>Listeners</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="server.html#goodbye" class="tsd-kind-icon">goodbye</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="server.html#initialize" class="tsd-kind-icon">initialize</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="server.html#listenercount" class="tsd-kind-icon">listener<wbr>Count</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="server.html#listeners" class="tsd-kind-icon">listeners</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="server.html#log" class="tsd-kind-icon">log</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="server.html#off" class="tsd-kind-icon">off</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="server.html#on" class="tsd-kind-icon">on</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="server.html#once" class="tsd-kind-icon">once</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="server.html#prependlistener" class="tsd-kind-icon">prepend<wbr>Listener</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="server.html#prependoncelistener" class="tsd-kind-icon">prepend<wbr>Once<wbr>Listener</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="server.html#processaction" class="tsd-kind-icon">process<wbr>Action</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="server.html#processfile" class="tsd-kind-icon">process<wbr>File</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="server.html#rawlisteners" class="tsd-kind-icon">raw<wbr>Listeners</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="server.html#removealllisteners" class="tsd-kind-icon">remove<wbr>All<wbr>Listeners</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="server.html#removelistener" class="tsd-kind-icon">remove<wbr>Listener</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="server.html#sendfile" class="tsd-kind-icon">send<wbr>File</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="server.html#sendmessage" class="tsd-kind-icon">send<wbr>Message</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="server.html#setmaxlisteners" class="tsd-kind-icon">set<wbr>Max<wbr>Listeners</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="server.html#start" class="tsd-kind-icon">start</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="server.html#stop" class="tsd-kind-icon">stop</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="server.html#validate" class="tsd-kind-icon">validate</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static"><a href="server.html#listenercount-1" class="tsd-kind-icon">listener<wbr>Count</a></li> </ul> </section> </div> </section> </section> <section class="tsd-panel-group tsd-member-group "> <h2>Constructors</h2> <section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite"> <a name="constructor" class="tsd-anchor"></a> <h3>constructor</h3> <ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite"> <li class="tsd-signature tsd-kind-icon">new <wbr>Server<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="server.html" class="tsd-signature-type">Server</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <p>Overrides EventEmitter.__constructor</p> <ul> <li>Defined in <a href="https://github.com/actionhero/actionhero/blob/fd12b4f0/src/classes/server.ts#L41">src/classes/server.ts:41</a></li> </ul> </aside> <h4 class="tsd-returns-title">Returns <a href="server.html" class="tsd-signature-type">Server</a></h4> </li> </ul> </section> </section> <section class="tsd-panel-group tsd-member-group "> <h2>Properties</h2> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"> <a name="attributes" class="tsd-anchor"></a> <h3>attributes</h3> <div class="tsd-signature tsd-kind-icon">attributes<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{}</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/actionhero/actionhero/blob/fd12b4f0/src/classes/server.ts#L25">src/classes/server.ts:25</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>attributes of the server</p> </div> </div> <div class="tsd-type-declaration"> <h4>Type declaration</h4> <ul class="tsd-parameters"> <li class="tsd-parameter-index-signature"> <h5><span class="tsd-signature-symbol">[</span>key: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">]: </span><span class="tsd-signature-type">any</span></h5> </li> </ul> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"> <a name="canchat" class="tsd-anchor"></a> <h3>can<wbr>Chat</h3> <div class="tsd-signature tsd-kind-icon">can<wbr>Chat<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/actionhero/actionhero/blob/fd12b4f0/src/classes/server.ts#L29">src/classes/server.ts:29</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Can connections of this server use the chat system?</p> </div> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"> <a name="config" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagOptional">Optional</span> config</h3> <div class="tsd-signature tsd-kind-icon">config<span class="tsd-signature-symbol">:</span> <a href="../interfaces/serverconfig.html" class="tsd-signature-type">ServerConfig</a></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/actionhero/actionhero/blob/fd12b4f0/src/classes/server.ts#L20">src/classes/server.ts:20</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Shorthand for <code>api.config.servers[this.type]</code></p> </div> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"> <a name="connectioncustommethods" class="tsd-anchor"></a> <h3>connection<wbr>Custom<wbr>Methods</h3> <div class="tsd-signature tsd-kind-icon">connection<wbr>Custom<wbr>Methods<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{}</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/actionhero/actionhero/blob/fd12b4f0/src/classes/server.ts#L37">src/classes/server.ts:37</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Methods described by the server to apply to each connection (like connection.setHeader for web connections)</p> </div> </div> <div class="tsd-type-declaration"> <h4>Type declaration</h4> <ul class="tsd-parameters"> <li class="tsd-parameter-index-signature"> <h5><span class="tsd-signature-symbol">[</span>key: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">]: </span><span class="tsd-signature-type">Function</span></h5> </li> </ul> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"> <a name="logconnections" class="tsd-anchor"></a> <h3>log<wbr>Connections</h3> <div class="tsd-signature tsd-kind-icon">log<wbr>Connections<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/actionhero/actionhero/blob/fd12b4f0/src/classes/server.ts#L31">src/classes/server.ts:31</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Should we log every new connection?</p> </div> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"> <a name="logexits" class="tsd-anchor"></a> <h3>log<wbr>Exits</h3> <div class="tsd-signature tsd-kind-icon">log<wbr>Exits<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/actionhero/actionhero/blob/fd12b4f0/src/classes/server.ts#L33">src/classes/server.ts:33</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Should we log when a connection disconnects/exits?</p> </div> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"> <a name="options" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagOptional">Optional</span> options</h3> <div class="tsd-signature tsd-kind-icon">options<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{}</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/actionhero/actionhero/blob/fd12b4f0/src/classes/server.ts#L21">src/classes/server.ts:21</a></li> </ul> </aside> <div class="tsd-type-declaration"> <h4>Type declaration</h4> <ul class="tsd-parameters"> <li class="tsd-parameter-index-signature"> <h5><span class="tsd-signature-symbol">[</span>key: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">]: </span><span class="tsd-signature-type">any</span></h5> </li> </ul> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"> <a name="sendwelcomemessage" class="tsd-anchor"></a> <h3>send<wbr>Welcome<wbr>Message</h3> <div class="tsd-signature tsd-kind-icon">send<wbr>Welcome<wbr>Message<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/actionhero/actionhero/blob/fd12b4f0/src/classes/server.ts#L35">src/classes/server.ts:35</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Should every new connection of this server type receive the welcome message (defined in locales, <code>actionhero.welcomeMessage</code>)</p> </div> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"> <a name="server-1" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagOptional">Optional</span> server</h3> <div class="tsd-signature tsd-kind-icon">server<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/actionhero/actionhero/blob/fd12b4f0/src/classes/server.ts#L41">src/classes/server.ts:41</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>A place to store the actually server object you create</p> </div> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"> <a name="type" class="tsd-anchor"></a> <h3>type</h3> <div class="tsd-signature tsd-kind-icon">type<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/actionhero/actionhero/blob/fd12b4f0/src/classes/server.ts#L16">src/classes/server.ts:16</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>The name &amp; type of the server.</p> </div> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"> <a name="verbs" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagOptional">Optional</span> verbs</h3> <div class="tsd-signature tsd-kind-icon">verbs<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Array</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/actionhero/actionhero/blob/fd12b4f0/src/classes/server.ts#L18">src/classes/server.ts:18</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>What connection verbs can connections of this type use?</p> </div> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static"> <a name="defaultmaxlisteners" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagStatic">Static</span> default<wbr>Max<wbr>Listeners</h3> <div class="tsd-signature tsd-kind-icon">default<wbr>Max<wbr>Listeners<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div> <aside class="tsd-sources"> <p>Inherited from <a href="server.html">Server</a>.<a href="server.html#defaultmaxlisteners">defaultMaxListeners</a></p> <ul> <li>Defined in node_modules/@types/node/events.d.ts:45</li> </ul> </aside> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static"> <a name="errormonitor" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagStatic">Static</span> <span class="tsd-flag ts-flagReadonly">Readonly</span> error<wbr>Monitor</h3> <div class="tsd-signature tsd-kind-icon">error<wbr>Monitor<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">keyof </span><span class="tsd-signature-type">symbol</span></div> <aside class="tsd-sources"> <p>Inherited from <a href="server.html">Server</a>.<a href="server.html#errormonitor">errorMonitor</a></p> <ul> <li>Defined in node_modules/@types/node/events.d.ts:55</li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>This symbol shall be used to install a listener for only monitoring <code>&#39;error&#39;</code> events. Listeners installed using this symbol are called before the regular <code>&#39;error&#39;</code> listeners are called.</p> </div> <p>Installing a listener using this symbol does not change the behavior once an <code>&#39;error&#39;</code> event is emitted, therefore the process will still crash if no regular <code>&#39;error&#39;</code> listener is installed.</p> </div> </section> </section> <section class="tsd-panel-group tsd-member-group "> <h2>Methods</h2> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <a name="addlistener" class="tsd-anchor"></a> <h3>add<wbr>Listener</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <li class="tsd-signature tsd-kind-icon">add<wbr>Listener<span class="tsd-signature-symbol">(</span>event<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span>, listener<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <p>Inherited from <a href="server.html">Server</a>.<a href="server.html#addlistener">addListener</a></p> <ul> <li>Defined in node_modules/@types/node/globals.d.ts:554</li> </ul> </aside> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>event: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></h5> </li> <li> <h5>listener: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><span class="tsd-signature-type">void</span></h5> <ul class="tsd-parameters"> <li class="tsd-parameter-signature"> <ul class="tsd-signatures tsd-kind-type-literal"> <li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5><span class="tsd-flag ts-flagRest">Rest</span> <span class="tsd-signature-symbol">...</span>args: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </li> </ul> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="buildconnection" class="tsd-anchor"></a> <h3>build<wbr>Connection</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">build<wbr>Connection<span class="tsd-signature-symbol">(</span>data<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/actionhero/actionhero/blob/fd12b4f0/src/classes/server.ts#L165">src/classes/server.ts:165</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <ul> <li>Build a the Actionhero.Connection from the raw parts provided by the server.<pre><code class="language-js"><span class="hljs-keyword">this</span>.buildConnection({ <span class="hljs-attr">rawConnection</span>: { <span class="hljs-attr">req</span>: req, <span class="hljs-attr">res</span>: res, <span class="hljs-attr">params</span>: {}, <span class="hljs-attr">method</span>: method, <span class="hljs-attr">cookies</span>: cookies, <span class="hljs-attr">responseHeaders</span>: responseHeaders, <span class="hljs-attr">responseHttpCode</span>: responseHttpCode, <span class="hljs-attr">parsedURL</span>: parsedURL }, <span class="hljs-attr">id</span>: fingerprint + <span class="hljs-string">'-'</span> + uuid.v4(), <span class="hljs-attr">fingerprint</span>: fingerprint, <span class="hljs-attr">remoteAddress</span>: remoteIP, <span class="hljs-attr">remotePort</span>: remotePort })</code></pre> </li> </ul> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>data: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="connections" class="tsd-anchor"></a> <h3>connections</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">connections<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Array</span><span class="tsd-signature-symbol">&lt;</span><a href="connection.html" class="tsd-signature-type">Connection</a><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/actionhero/actionhero/blob/fd12b4f0/src/classes/server.ts#L251">src/classes/server.ts:251</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Enumerate the connections for this server type on this server.</p> </div> </div> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Array</span><span class="tsd-signature-symbol">&lt;</span><a href="connection.html" class="tsd-signature-type">Connection</a><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="defaultattributes" class="tsd-anchor"></a> <h3>default<wbr>Attributes</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">default<wbr>Attributes<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>canChat<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span>logConnections<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span>logExits<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span>sendWelcomeMessage<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span>type<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol">; </span>verbs<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> }</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/actionhero/actionhero/blob/fd12b4f0/src/classes/server.ts#L113">src/classes/server.ts:113</a></li> </ul> </aside> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{ </span>canChat<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span>logConnections<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span>logExits<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span>sendWelcomeMessage<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span>type<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol">; </span>verbs<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> }</span></h4> <ul class="tsd-parameters"> <li class="tsd-parameter"> <h5>can<wbr>Chat<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></h5> </li> <li class="tsd-parameter"> <h5>log<wbr>Connections<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></h5> </li> <li class="tsd-parameter"> <h5>log<wbr>Exits<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></h5> </li> <li class="tsd-parameter"> <h5>send<wbr>Welcome<wbr>Message<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></h5> </li> <li class="tsd-parameter"> <h5>type<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span></h5> </li> <li class="tsd-parameter"> <h5>verbs<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol">[]</span></h5> </li> </ul> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <a name="emit" class="tsd-anchor"></a> <h3>emit</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <li class="tsd-signature tsd-kind-icon">emit<span class="tsd-signature-symbol">(</span>event<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span>, <span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <p>Inherited from <a href="server.html">Server</a>.<a href="server.html#emit">emit</a></p> <ul> <li>Defined in node_modules/@types/node/globals.d.ts:564</li> </ul> </aside> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>event: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></h5> </li> <li> <h5><span class="tsd-flag ts-flagRest">Rest</span> <span class="tsd-signature-symbol">...</span>args: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <a name="eventnames" class="tsd-anchor"></a> <h3>event<wbr>Names</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <li class="tsd-signature tsd-kind-icon">event<wbr>Names<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Array</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <p>Inherited from <a href="server.html">Server</a>.<a href="server.html#eventnames">eventNames</a></p> <ul> <li>Defined in node_modules/@types/node/globals.d.ts:569</li> </ul> </aside> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Array</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <a name="getmaxlisteners" class="tsd-anchor"></a> <h3>get<wbr>Max<wbr>Listeners</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <li class="tsd-signature tsd-kind-icon">get<wbr>Max<wbr>Listeners<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <p>Inherited from <a href="server.html">Server</a>.<a href="server.html#getmaxlisteners">getMaxListeners</a></p> <ul> <li>Defined in node_modules/@types/node/globals.d.ts:561</li> </ul> </aside> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="goodbye" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagOptional">Optional</span> goodbye</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">goodbye<span class="tsd-signature-symbol">(</span>connection<span class="tsd-signature-symbol">: </span><a href="connection.html" class="tsd-signature-type">Connection</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/actionhero/actionhero/blob/fd12b4f0/src/classes/server.ts#L111">src/classes/server.ts:111</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>An optional message to send to clients when they disconnect</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>connection: <a href="connection.html" class="tsd-signature-type">Connection</a></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="initialize" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagAbstract">Abstract</span> initialize</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">initialize<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/actionhero/actionhero/blob/fd12b4f0/src/classes/server.ts#L77">src/classes/server.ts:77</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Method run as part of the <code>initialize</code> lifecycle of your server. Usually configures the server.</p> </div> </div> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <a name="listenercount" class="tsd-anchor"></a> <h3>listener<wbr>Count</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <li class="tsd-signature tsd-kind-icon">listener<wbr>Count<span class="tsd-signature-symbol">(</span>type<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <p>Inherited from <a href="server.html">Server</a>.<a href="server.html#listenercount">listenerCount</a></p> <ul> <li>Defined in node_modules/@types/node/globals.d.ts:565</li> </ul> </aside> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>type: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <a name="listeners" class="tsd-anchor"></a> <h3>listeners</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <li class="tsd-signature tsd-kind-icon">listeners<span class="tsd-signature-symbol">(</span>event<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol">[]</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <p>Inherited from <a href="server.html">Server</a>.<a href="server.html#listeners">listeners</a></p> <ul> <li>Defined in node_modules/@types/node/globals.d.ts:562</li> </ul> </aside> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>event: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol">[]</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="log" class="tsd-anchor"></a> <h3>log</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">log<span class="tsd-signature-symbol">(</span>message<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, severity<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span>, data<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/actionhero/actionhero/blob/fd12b4f0/src/classes/server.ts#L267">src/classes/server.ts:267</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Log a message from this server type. A wrapper around log() with a server prefix.</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>message: <span class="tsd-signature-type">string</span></h5> </li> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> severity: <span class="tsd-signature-type">string</span></h5> </li> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> data: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <a name="off" class="tsd-anchor"></a> <h3>off</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited"> <li class="tsd-signature tsd-kind-icon">off<span class="tsd-signature-symbol">(</span>event<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span>, listener<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <p>Inherited from <a href="server.html">Server</a>.<a href="server.html#off">off</a></p> <ul> <li>Defined in node_modules/@types/node/globals.d.ts:558</li> </ul> </aside> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>event: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></h5> </li> <li> <h5>listener: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><span class="tsd-signature-type">void</span></h5> <ul class="tsd-parameters"> <li class="tsd-parameter-signature"> <ul class="tsd-signatures tsd-kind-type-literal"> <li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5><span class="tsd-flag ts-flagRest">Rest</span> <span class="tsd-signature-symbol">...</span>args: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>