diff --git a/index.js b/index.js index 2998ade..46dcd3f 100644 --- a/index.js +++ b/index.js @@ -237,7 +237,7 @@ module.exports.categories = { } const data = [ "subscribe", - categoriesID + [categoriesID] ]; socket.send(`42/gateway,${JSON.stringify(data)}`); @@ -293,7 +293,11 @@ module.exports.categories = { } case "clientListUpdate": { const categoryID = data[1].category._id; + if (!categories[categoryID]) + categories[categoryID] = {}; + const callback = categories[categoryID].updateCallback; + if (callback) { categories[categoryID].updateCallback = null; callback(categoryID);