This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var schema = mongoose.Schema({ | |
lastUpdated: {type: Date, 'default': Date.now} | |
}) | |
schema.pre('save', function(next) { | |
this.lastUpdated = Date.now() | |
next() | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Tracks server pings for determining if the connection dropped. | |
* Will terminate non-responsive connections. | |
* This close event should initiate the process of recreating the connection in the ws module manager (eg ws/user.js and modules/ws-user.js) | |
*/ | |
function setupWsHeartbeat(ws) { | |
// will close the connection if there's no ping from the server | |
function heartbeat() { | |
clearTimeout(this.pingTimeout); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const initialState = { | |
type: null, | |
payload: null, | |
meta: null, | |
error: false | |
}; | |
export default (state = initialState, action) => { | |
return { | |
...state, |