diff --git a/socketio.js b/socketio.js index 1febeaff1f..458563c9c2 100644 --- a/socketio.js +++ b/socketio.js @@ -49,33 +49,6 @@ io.on('connection', function (socket) { socket.user = cookie.parse(socket.request.headers.cookie).user_id; socket.files = {}; - // frappe namespace (temporary till webpack comes in, we can then reuse). - const frappe = { }; - frappe._ = { }; - - frappe._.compact = function (arr) { return arr.filter(Boolean) } - - // frappe.model - // Realtime Database Updates FTW! - function get_model_room (doctype, name, field) { - const site = get_site_name(socket) - const room = frappe._.compact([site, doctype, name, field]).join(":") - - return room - } - - socket.on('frappe.model:subscribe', function (params) { - const doctype = params.doctype - const name = params.name - const field = params.field - - const room = get_model_room(doctype, name, field) - - console.log('frappe.model: Subscribing ' + socket.user + ' to room ' + room); - socket.join(room); - }) - // end frappe.model - // frappe.chat socket.on("frappe.chat.room:subscribe", function (rooms) { if (!Array.isArray(rooms)) { @@ -90,6 +63,7 @@ io.on('connection', function (socket) { socket.join(room); } }); + socket.on("frappe.chat.message:typing", function (data) { const user = data.user; const room = get_chat_room(socket, data.room); @@ -119,9 +93,7 @@ io.on('connection', function (socket) { socket.join(get_site_room(socket)); } }); - - - + socket.on('disconnect', function () { delete socket.files; })