UNPKG

@100mslive/hms-video-store

Version:

@100mslive Core SDK which abstracts the complexities of webRTC while providing a reactive store for data management with a unidirectional data flow

22 lines (18 loc) 791 B
import { HMSUpdateListener } from '../../interfaces'; import HMSLogger from '../../utils/logger'; import { HMSNotificationMethod } from '../HMSNotificationMethod'; import { MessageNotification } from '../HMSNotifications'; export class BroadcastManager { private readonly TAG = '[BroadcastManager]'; constructor(public listener?: HMSUpdateListener) {} handleNotification(method: string, notification: any) { if (method !== HMSNotificationMethod.BROADCAST) { return; } this.handleBroadcast(notification); } private handleBroadcast(messageNotification: MessageNotification) { HMSLogger.d(this.TAG, `Received Message from sender=${messageNotification?.peer?.peer_id}: ${messageNotification}`); this.listener?.onMessageReceived(messageNotification); } }