properly delegate to sub classes for channels and clients

This commit is contained in:
Josh Burman
2019-03-11 16:55:44 -04:00
parent cdd6179992
commit 74aad4a957
11 changed files with 66 additions and 44 deletions

View File

@ -5,15 +5,16 @@ import ChannelBase from '../channelBase';
class MHSChannel extends ChannelBase {
broadcastMessage(from: ClientBase|MHSClient|null, message: string) {
for (let client of this.clients) {
if (client != from) {
if (client != from && client.data.user_type == 'teacher') {
client.ws.send(message);
console.log(`sent to ${client.id}: %s`, message);
console.log(message);
} else {
console.log('client is same as sender');
console.log('client is same as sender and/or not a teacher.');
}
}
}
};
module.exports = MHSChannel;
export default MHSChannel;