canopy/www/doc/channelManager.html

2000 lines
25 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: channelManager</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: channelManager</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>channelManager<span class="signature">(io)</span><span class="type-signature"></span></h2>
<div class="class-description">Class containing global server-side channel connection management logic</div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="channelManager"><span class="type-signature"></span>new channelManager<span class="signature">(io)</span><span class="type-signature"></span></h4>
<div class="description">
Instantiates object containing global server-side channel conection management logic
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>io</code></td>
<td class="type">
<span class="param-type">Server</span>
</td>
<td class="description last">Socket.io server instanced passed down from server.js</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="app_channel_channelManager.js.html">app/channel/channelManager.js</a>, <a href="app_channel_channelManager.js.html#line33">line 33</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="authSocket"><span class="type-signature">(async) </span>authSocket<span class="signature">(socket)</span><span class="type-signature"> &rarr; {Mongoose.Document}</span></h4>
<div class="description">
Global server-side authorization logic for new connections to any channel
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>socket</code></td>
<td class="type">
<span class="param-type">Socket</span>
</td>
<td class="description last">Requesting Socket</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="app_channel_channelManager.js.html">app/channel/channelManager.js</a>, <a href="app_channel_channelManager.js.html#line152">line 152</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- Authorized User Document upon success
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Mongoose.Document</span>
</dd>
</dl>
<h4 class="name" id="broadcastSiteEmotes"><span class="type-signature">(async) </span>broadcastSiteEmotes<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Broadcast global emote list
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="app_channel_channelManager.js.html">app/channel/channelManager.js</a>, <a href="app_channel_channelManager.js.html#line297">line 297</a>
</li></ul></dd>
</dl>
<h4 class="name" id="crawlConnections"><span class="type-signature"></span>crawlConnections<span class="signature">(user, cb)</span><span class="type-signature"></span></h4>
<div class="description">
Iterates through connections by a given username, and runs them through a given callback function/method
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>user</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Username to crawl connections against</td>
</tr>
<tr>
<td class="name"><code>cb</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">Callback function to run active connections of a given user against</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="app_channel_channelManager.js.html">app/channel/channelManager.js</a>, <a href="app_channel_channelManager.js.html#line254">line 254</a>
</li></ul></dd>
</dl>
<h4 class="name" id="defineListeners"><span class="type-signature"></span>defineListeners<span class="signature">(socket)</span><span class="type-signature"></span></h4>
<div class="description">
Define Global Server-Side socket event listeners
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>socket</code></td>
<td class="type">
<span class="param-type">Socket</span>
</td>
<td class="description last">Socket to check</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="app_channel_channelManager.js.html">app/channel/channelManager.js</a>, <a href="app_channel_channelManager.js.html#line200">line 200</a>
</li></ul></dd>
</dl>
<h4 class="name" id="getActiveChan"><span class="type-signature">(async) </span>getActiveChan<span class="signature">(socket)</span><span class="type-signature"> &rarr; {Object}</span></h4>
<div class="description">
Gets active channel from a given socket
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>socket</code></td>
<td class="type">
<span class="param-type">Socket</span>
</td>
<td class="description last">Socket to check</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="app_channel_channelManager.js.html">app/channel/channelManager.js</a>, <a href="app_channel_channelManager.js.html#line174">line 174</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Object containing users active channel name and channel document object
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
<h4 class="name" id="getConnectedChannels"><span class="type-signature"></span>getConnectedChannels<span class="signature">(socket)</span><span class="type-signature"></span></h4>
<div class="description">
Pulls user information by socket
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>socket</code></td>
<td class="type">
<span class="param-type">Socket</span>
</td>
<td class="description last">Socket to check</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="app_channel_channelManager.js.html">app/channel/channelManager.js</a>, <a href="app_channel_channelManager.js.html#line230">line 230</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
returns related user info
</div>
<h4 class="name" id="getConnections"><span class="type-signature"></span>getConnections<span class="signature">(user, cb)</span><span class="type-signature"></span></h4>
<div class="description">
Iterates through connections by a given username, and runs them through a given callback function/method
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>user</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Username to crawl connections against</td>
</tr>
<tr>
<td class="name"><code>cb</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">Callback function to run active connections of a given user against</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="app_channel_channelManager.js.html">app/channel/channelManager.js</a>, <a href="app_channel_channelManager.js.html#line272">line 272</a>
</li></ul></dd>
</dl>
<h4 class="name" id="getSocketInfo"><span class="type-signature"></span>getSocketInfo<span class="signature">(socket)</span><span class="type-signature"></span></h4>
<div class="description">
Pulls user information by socket
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>socket</code></td>
<td class="type">
<span class="param-type">Socket</span>
</td>
<td class="description last">Socket to check</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="app_channel_channelManager.js.html">app/channel/channelManager.js</a>, <a href="app_channel_channelManager.js.html#line220">line 220</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
returns related user info
</div>
<h4 class="name" id="handleConnection"><span class="type-signature">(async) </span>handleConnection<span class="signature">(socket)</span><span class="type-signature"></span></h4>
<div class="description">
Handles global server-side initialization for new connections to any channel
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>socket</code></td>
<td class="type">
<span class="param-type">Socket</span>
</td>
<td class="description last">Requesting Socket</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="app_channel_channelManager.js.html">app/channel/channelManager.js</a>, <a href="app_channel_channelManager.js.html#line57">line 57</a>
</li></ul></dd>
</dl>
<h4 class="name" id="handleDisconnect"><span class="type-signature"></span>handleDisconnect<span class="signature">(socket, reason)</span><span class="type-signature"></span></h4>
<div class="description">
Global server-side logic for handling disconncted sockets
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>socket</code></td>
<td class="type">
<span class="param-type">Socket</span>
</td>
<td class="description last">Socket to check</td>
</tr>
<tr>
<td class="name"><code>reason</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Reason for disconnection</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="app_channel_channelManager.js.html">app/channel/channelManager.js</a>, <a href="app_channel_channelManager.js.html#line210">line 210</a>
</li></ul></dd>
</dl>
<h4 class="name" id="kickConnections"><span class="type-signature"></span>kickConnections<span class="signature">(user, reason)</span><span class="type-signature"></span></h4>
<div class="description">
Kicks a user from all channels by username
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>user</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Username to kick from the server</td>
</tr>
<tr>
<td class="name"><code>reason</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Reason for kick</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="app_channel_channelManager.js.html">app/channel/channelManager.js</a>, <a href="app_channel_channelManager.js.html#line289">line 289</a>
</li></ul></dd>
</dl>
<h4 class="name" id="validateSocket"><span class="type-signature">(async) </span>validateSocket<span class="signature">(socket)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
<div class="description">
Global server-side validation logic for new connections to any channel
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>socket</code></td>
<td class="type">
<span class="param-type">Socket</span>
</td>
<td class="description last">Requesting Socket</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="app_channel_channelManager.js.html">app/channel/channelManager.js</a>, <a href="app_channel_channelManager.js.html#line110">line 110</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
true on success
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="activeChannel.html">activeChannel</a></li><li><a href="channelManager.html">channelManager</a></li><li><a href="chat.html">chat</a></li><li><a href="chatBuffer.html">chatBuffer</a></li><li><a href="chatHandler.html">chatHandler</a></li><li><a href="commandPreprocessor.html">commandPreprocessor</a></li><li><a href="commandProcessor.html">commandProcessor</a></li><li><a href="connectedUser.html">connectedUser</a></li><li><a href="media.html">media</a></li><li><a href="playlistHandler.html">playlistHandler</a></li><li><a href="queue.html">queue</a></li><li><a href="queuedMedia.html">queuedMedia</a></li><li><a href="tokebot.html">tokebot</a></li></ul><h3>Global</h3><ul><li><a href="global.html#authenticateSession">authenticateSession</a></li><li><a href="global.html#cache">cache</a></li><li><a href="global.html#channelBanSchema">channelBanSchema</a></li><li><a href="global.html#channelPermissionSchema">channelPermissionSchema</a></li><li><a href="global.html#channelSchema">channelSchema</a></li><li><a href="global.html#chatSchema">chatSchema</a></li><li><a href="global.html#comparePassword">comparePassword</a></li><li><a href="global.html#consoleWarn">consoleWarn</a></li><li><a href="global.html#daysToExpire">daysToExpire</a></li><li><a href="global.html#emailChangeSchema">emailChangeSchema</a></li><li><a href="global.html#emoteSchema">emoteSchema</a></li><li><a href="global.html#errorHandler">errorHandler</a></li><li><a href="global.html#errorMiddleware">errorMiddleware</a></li><li><a href="global.html#escapeRegex">escapeRegex</a></li><li><a href="global.html#exceptionHandler">exceptionHandler</a></li><li><a href="global.html#exceptionSmith">exceptionSmith</a></li><li><a href="global.html#failedAttempts">failedAttempts</a></li><li><a href="global.html#fetchMetadata">fetchMetadata</a></li><li><a href="global.html#fetchVideoMetadata">fetchVideoMetadata</a></li><li><a href="global.html#fetchYoutubeMetadata">fetchYoutubeMetadata</a></li><li><a href="global.html#fetchYoutubePlaylistMetadata">fetchYoutubePlaylistMetadata</a></li><li><a href="global.html#flairSchema">flairSchema</a></li><li><a href="global.html#genCaptcha">genCaptcha</a></li><li><a href="global.html#getLoginAttempts">getLoginAttempts</a></li><li><a href="global.html#getMediaType">getMediaType</a></li><li><a href="global.html#hashIP">hashIP</a></li><li><a href="global.html#hashPassword">hashPassword</a></li><li><a href="global.html#kickoff">kickoff</a></li><li><a href="global.html#killSession">killSession</a></li><li><a href="global.html#lifetime">lifetime</a></li><li><a href="global.html#localExceptionHandler">localExceptionHandler</a></li><li><a href="global.html#mailem">mailem</a></li><li><a href="global.html#markLink">markLink</a></li><li><a href="global.html#maxAttempts">maxAttempts</a></li><li><a href="global.html#mediaSchema">mediaSchema</a></li><li><a href="global.html#passwordResetSchema">passwordResetSchema</a></li><li><a href="global.html#permissionSchema">permissionSchema</a></li><li><a href="global.html#playlistMediaProperties">playlistMediaProperties</a></li><li><a href="global.html#playlistSchema">playlistSchema</a></li><li><a href="global.html#processExpiredAttempts">processExpiredAttempts</a></li><li><a href="global.html#queuedProperties">queuedProperties</a></li><li><a href="global.html#rankEnum">rankEnum</a></li><li><a href="global.html#refreshRawLink">refreshRawLink</a></li><li><a href="global.html#schedule">schedule</a></li><li><a href="global.html#securityCheck">securityCheck</a></li><li><a href="global.html#sendAddressVerification">sendAddressVerification</a></li><li><a href="global.html#socketCriticalExceptionHandler">socketCriticalExceptionHandler</a></li><li><a href="global.html#socketErrorHandler">socketErrorHandler</a></li><li><a href="global.html#socketExceptionHandler">socketExceptionHandler</a></li><li><a href="global.html#spent">spent</a></li><li><a href="global.html#statSchema">statSchema</a></li><li><a href="global.html#throttleAttempts">throttleAttempts</a></li><li><a href="global.html#tokeCommandSchema">tokeCommandSchema</a></li><li><a href="global.html#transporter">transporter</a></li><li><a href="global.html#typeEnum">typeEnum</a></li><li><a href="global.html#userBanSchema">userBanSchema</a></li><li><a href="global.html#userSchema">userSchema</a></li><li><a href="global.html#verify">verify</a></li><li><a href="global.html#yankMedia">yankMedia</a></li><li><a href="global.html#ytdlpFetch">ytdlpFetch</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.4</a> on Tue Sep 02 2025 07:28:58 GMT-0400 (Eastern Daylight Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>