bigbluebutton-Github/bigbluebutton-html5/imports/startup/server/etherpad.js
Pedro Beschorner Marin 0c4cf0135d Handle pad's events and Meteor's instances
Since Meteor was split in multiple process and events started to be
filtered by instances, all Etherpad's Redis events were being discarded.

Etherpad has a Redis' publisher plugin that is unaware of BigBlueButton's
existence. All the communication between them is kept simple with minimal
of internal data exchange. The concept of distincts subscribers at Meteor's
side broke part of this simplicity and, now, Etherpad has to know which
instance must receive it's messages. To provide such information I decided
to include Meteor's instance as part of the pad's id. Should look like:

 - [instanceId]padId for the shared notes
 - [instanceId]padId_cc_(locale) for the closed captions

With those changes the pad id generation made at the recording scripts had to
be re-done because there is no instance id available. Pad id is now recorded at
akka-apps and queried while archiving the shared notes.
2021-03-23 18:03:50 -03:00

27 lines
598 B
JavaScript

const INSTANCE_ID_REGEX = /\d+/;
const isPadMessage = (message) => {
const { name } = message.core.header;
const isPadCreate = name === 'PadCreateSysMsg';
const isPadUpdate = name === 'PadUpdateSysMsg';
return isPadCreate || isPadUpdate;
};
const getInstanceIdFromPadMessage = (message) => {
let instanceId;
const { id } = message.core.body.pad;
// Pad id is composed by the instance id between brackets
const match = id.match(INSTANCE_ID_REGEX);
if (match) instanceId = parseInt(match[0]);
return instanceId;
};
export {
isPadMessage,
getInstanceIdFromPadMessage,
};