properly delegate to sub classes for channels and clients
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user