Messages received by the WebSocket server are now saved in a file

This commit is contained in:
Yann Flory
2016-03-16 14:57:13 +01:00
parent e77d85bc82
commit 7ee75b9e7f
3 changed files with 23 additions and 1 deletions

20
storage/LogStore.js Normal file
View File

@@ -0,0 +1,20 @@
var Fs = require("fs");
var message = function(file, msg) {
file.write(msg+"\n");
}
var create = module.exports.create = function(filePath, backingStore) {
var file = Fs.createWriteStream(filePath, {flags: 'a+'});
return {
message: function(channel, msg, callback) {
message(file, msg);
backingStore.message(channel, msg, callback);
},
getMessages: backingStore.getMessages
}
}