Merge pull request #2003 from overleaf/bg-use-individual-channels

support individual pubsub channels

GitOrigin-RevId: e750eeb1945ddcf2c92d0d1878363f14da208984
This commit is contained in:
Brian Gough 2019-07-30 08:22:24 +01:00 committed by sharelatex
parent 49ac91efe6
commit e197d58103

View file

@ -26,8 +26,14 @@ module.exports = EditorRealTimeController = {
emitToRoom(room_id, message, ...payload) {
// create a unique message id using a counter
const message_id = `web:${HOST}:${RND}-${COUNT++}`
var channel
if (room_id === 'all' || !Settings.publishOnIndividualChannels) {
channel = 'editor-events'
} else {
channel = `editor-events:${room_id}`
}
return rclient.publish(
'editor-events',
channel,
JSON.stringify({
room_id,
message,