Send an ACK when someone asks for the history

This commit is contained in:
Yann Flory 2016-04-27 12:17:39 +02:00
parent 492054a938
commit 619406f868

View file

@ -103,6 +103,7 @@ const handleMessage = function (ctx, user, msg) {
let parsed;
try { parsed = JSON.parse(json[2]); } catch (err) { console.error(err); return; }
if (parsed[0] === 'GET_HISTORY') {
sendMsg(ctx, user, [seq, 'ACK']);
getHistory(ctx, parsed[1], function (msg) {
sendMsg(ctx, user, [0, HISTORY_KEEPER_ID, 'MSG', user.id, JSON.stringify(msg)]);
}, function () {