Constructor
new chatBuffer(server, chanDB, channel)
Instantiates a new chat buffer for a given channel
Parameters:
| Name | Type | Description |
|---|---|---|
server |
channelManager | Parent Server Object |
chanDB |
Mongoose.Document | chanDB to rehydrate buffer from |
channel |
activeChannel | Parent Channel Object |
- Source:
Methods
handleBusyRoom()
Called after 5 minutes of solid activity
- Source:
handleInactivity()
Called after 10 seconds of chat room inactivity
- Source:
push(chat)
Adds a given chat to the chat buffer in RAM and sets any appropriate timers for DB transactions
Parameters:
| Name | Type | Description |
|---|---|---|
chat |
chat | Chat object to commit to buffer |
- Source:
(async) saveDB(reason, chanDB)
Saves RAM-Based buffer to Channel Document in DB
Parameters:
| Name | Type | Description |
|---|---|---|
reason |
String | Reason for DB save, formatted as 'x minutes/seconds of in/activity', used for logging purposes |
chanDB |
Mongoose.Document | Channel Doc to work with, can be left empty for method to auto-find through channel name. |
- Source:
shift()
Removes the oldest item from the chat buffer
Was originally created in-case we needed to trigger timing functions
Left here since it seems like good form anywho, since this would be a private, or at least protected member in another language
- Source: