Update streamer to use Meteor.StreamerCentral

This commit is contained in:
Joao Siebel 2019-10-24 15:03:05 -03:00
parent bbbd97929d
commit eecf0bcfd1
2 changed files with 4 additions and 9 deletions

View File

@ -1,14 +1,11 @@
const streamers = {};
export function removeAnnotationsStreamer(meetingId) {
delete streamers[meetingId];
delete Meteor.StreamerCentral.instances[`annotations-${meetingId}`];
}
export function addAnnotationsStreamer(meetingId) {
const streamer = new Meteor.Streamer(`annotations-${meetingId}`, { retransmit: false });
streamer.allowRead(function a() {
streamer.allowRead(function allowRead() {
if (!this.userId) return false;
return this.userId && this.userId.includes(meetingId);
@ -17,10 +14,8 @@ export function addAnnotationsStreamer(meetingId) {
streamer.allowWrite(function allowWrite() {
return false;
});
streamers[meetingId] = streamer;
}
export default function get(meetingId) {
return streamers[meetingId];
return Meteor.StreamerCentral.instances[`annotations-${meetingId}`];
}

View File

@ -93,11 +93,11 @@ export default withTracker(() => {
Meteor.subscribe('users', credentials, userIsModerator, subscriptionErrorHandler);
Meteor.subscribe('breakouts', credentials, userIsModerator, subscriptionErrorHandler);
Meteor.subscribe('meetings', credentials, userIsModerator, subscriptionErrorHandler);
initAnnotationsStreamListener();
}
const annotationsHandler = Meteor.subscribe('annotations', credentials, {
onReady: () => {
initAnnotationsStreamListener();
const activeTextShapeId = AnnotationsTextService.activeTextShapeId();
AnnotationsLocal.remove({ id: { $ne: `${activeTextShapeId}-fake` } });
Annotations.find({ id: { $ne: activeTextShapeId } }, { reactive: false }).forEach((a) => {