I am on the client side of a websocket API which uses SocketCluster for its pub/sub.
After authenticating I receive every second json data via
SCsocket.on('authenticate', function(){
var channel = SCsocket.subscribe('channel1');
channel.watch(function(data){
console.log(data);
});
});
of the form
[
{
"product": "Product1",
"price": "10.0"
},
{
"product": "Product2",
"price": "15.0"
}
]
Instead of printing the data, I will save it to a mongo db.
In case some of the data cannot be uploaded, I need some sort of a safety net. Something that allows me to upload the data from the websocket to mongo db in retrospect.
What are best practices for doing that? I hope this question is not too broad, I am new to node and mongo db.
Thanks!