2019-11-14 00:53:45 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
|
2019-10-23 09:26:25 +08:00
|
|
|
export function removeAnnotationsStreamer(meetingId) {
|
2019-11-14 00:53:45 +08:00
|
|
|
Logger.info(`Removing Annotations streamer object for meeting ${meetingId}`);
|
2019-10-25 02:03:05 +08:00
|
|
|
delete Meteor.StreamerCentral.instances[`annotations-${meetingId}`];
|
2019-10-23 09:26:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export function addAnnotationsStreamer(meetingId) {
|
|
|
|
const streamer = new Meteor.Streamer(`annotations-${meetingId}`, { retransmit: false });
|
|
|
|
|
2019-10-25 02:03:05 +08:00
|
|
|
streamer.allowRead(function allowRead() {
|
2019-10-23 09:26:25 +08:00
|
|
|
if (!this.userId) return false;
|
|
|
|
|
|
|
|
return this.userId && this.userId.includes(meetingId);
|
|
|
|
});
|
|
|
|
|
|
|
|
streamer.allowWrite(function allowWrite() {
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
export default function get(meetingId) {
|
2019-10-25 02:03:05 +08:00
|
|
|
return Meteor.StreamerCentral.instances[`annotations-${meetingId}`];
|
2019-10-23 09:26:25 +08:00
|
|
|
}
|