intercept data changes and alter/validate from a server <p>I'm working on a solution to intercept changes to the data from our node.js server and validate/alter them before they are stored/synced to other clients.</p> <p>Any strategies or suggestions on how to solve this with the current code base? </p> <p>Currently, it seems like the only option is to rewrite it post-sync operation. That would mean each client would probably receive the sync (including the server), then the server would rewrite the data and trigger a second sync.</p> <p>To help understand the context of the question, here's what seems like an ideal strategy for my needs:</p> <ul> <li>server gets a special token/key not available to clients (when security comes about)</li> <li>server registers a dependency injection like <code>firebase.child('widgets').beforeSync(myCallback)</code></li> <li>client syncs data</li> <li>server callback is notified</li> <li>server modifies or validates the data</li> <li>if valid, it returns it to firebase for sync ops</li> <li>if invalid, aborts the sync with an error which is returned to the client</li> </ul>