Constructor
new channelManager(io)
Instantiates object containing global server-side channel conection management logic
Parameters:
| Name | Type | Description |
|---|---|---|
io |
Server | Socket.io server instanced passed down from server.js |
- Source:
Methods
(async) authSocket(socket) → {Mongoose.Document}
Global server-side authorization logic for new connections to any channel
Parameters:
| Name | Type | Description |
|---|---|---|
socket |
Socket | Requesting Socket |
- Source:
Returns:
- Authorized User Document upon success
- Type
- Mongoose.Document
(async) broadcastSiteEmotes()
Broadcast global emote list
- Source:
crawlConnections(user, cb)
Iterates through connections by a given username, and runs them through a given callback function/method
Parameters:
| Name | Type | Description |
|---|---|---|
user |
String | Username to crawl connections against |
cb |
function | Callback function to run active connections of a given user against |
- Source:
defineListeners(socket)
Define Global Server-Side socket event listeners
Parameters:
| Name | Type | Description |
|---|---|---|
socket |
Socket | Socket to check |
- Source:
(async) getActiveChan(socket) → {Object}
Gets active channel from a given socket
Parameters:
| Name | Type | Description |
|---|---|---|
socket |
Socket | Socket to check |
- Source:
Returns:
Object containing users active channel name and channel document object
- Type
- Object
getConnectedChannels(socket)
Pulls user information by socket
Parameters:
| Name | Type | Description |
|---|---|---|
socket |
Socket | Socket to check |
- Source:
Returns:
returns related user info
getConnections(user, cb)
Iterates through connections by a given username, and runs them through a given callback function/method
Parameters:
| Name | Type | Description |
|---|---|---|
user |
String | Username to crawl connections against |
cb |
function | Callback function to run active connections of a given user against |
- Source:
getSocketInfo(socket)
Pulls user information by socket
Parameters:
| Name | Type | Description |
|---|---|---|
socket |
Socket | Socket to check |
- Source:
Returns:
returns related user info
(async) handleConnection(socket)
Handles global server-side initialization for new connections to any channel
Parameters:
| Name | Type | Description |
|---|---|---|
socket |
Socket | Requesting Socket |
- Source:
handleDisconnect(socket, reason)
Global server-side logic for handling disconncted sockets
Parameters:
| Name | Type | Description |
|---|---|---|
socket |
Socket | Socket to check |
reason |
String | Reason for disconnection |
- Source:
kickConnections(user, reason)
Kicks a user from all channels by username
Parameters:
| Name | Type | Description |
|---|---|---|
user |
String | Username to kick from the server |
reason |
String | Reason for kick |
- Source:
(async) validateSocket(socket) → {Boolean}
Global server-side validation logic for new connections to any channel
Parameters:
| Name | Type | Description |
|---|---|---|
socket |
Socket | Requesting Socket |
- Source:
Returns:
true on success
- Type
- Boolean