diff --git a/src/modules/StreamingClient.ts b/src/modules/StreamingClient.ts index 92a69f0..f808fc6 100644 --- a/src/modules/StreamingClient.ts +++ b/src/modules/StreamingClient.ts @@ -273,6 +273,7 @@ export class StreamingClient { case SignalMessageAction.WARNING: const message = signalMessage.payload as string; console.warn('Warning received from server: ' + message); + this.publicEventEmitter.emit(AnamEvent.SERVER_WARNING, message); break; case SignalMessageAction.TALK_STREAM_INTERRUPTED: const chatMessage = @@ -282,9 +283,13 @@ export class StreamingClient { chatMessage.correlationId, ); break; + case SignalMessageAction.SESSION_READY: + const sessionId = signalMessage.sessionId as string; + this.publicEventEmitter.emit(AnamEvent.SESSION_READY, sessionId); + break; default: console.error( - 'StreamingClient - onSignalMessage: unknown signal message action type', + 'StreamingClient - onSignalMessage: unknown signal message action type. Is your anam-sdk version up to date?', signalMessage, ); } diff --git a/src/types/events/public/AnamEvent.ts b/src/types/events/public/AnamEvent.ts index b365166..fd02179 100644 --- a/src/types/events/public/AnamEvent.ts +++ b/src/types/events/public/AnamEvent.ts @@ -8,4 +8,6 @@ export enum AnamEvent { VIDEO_PLAY_STARTED = 'VIDEO_PLAY_STARTED', AUDIO_STREAM_STARTED = 'AUDIO_STREAM_STARTED', TALK_STREAM_INTERRUPTED = 'TALK_STREAM_INTERRUPTED', + SESSION_READY = 'SESSION_READY', + SERVER_WARNING = 'SERVER_WARNING', } diff --git a/src/types/events/public/EventCallbacks.ts b/src/types/events/public/EventCallbacks.ts index a647c64..74b73c3 100644 --- a/src/types/events/public/EventCallbacks.ts +++ b/src/types/events/public/EventCallbacks.ts @@ -12,4 +12,6 @@ export type EventCallbacks = { [AnamEvent.VIDEO_PLAY_STARTED]: () => void; [AnamEvent.AUDIO_STREAM_STARTED]: (audioStream: MediaStream) => void; [AnamEvent.TALK_STREAM_INTERRUPTED]: (correlationId: string) => void; + [AnamEvent.SESSION_READY]: (sessionId: string) => void; + [AnamEvent.SERVER_WARNING]: (message: string) => void; }; diff --git a/src/types/signalling/SignalMessage.ts b/src/types/signalling/SignalMessage.ts index 7052fbf..0fa26b0 100644 --- a/src/types/signalling/SignalMessage.ts +++ b/src/types/signalling/SignalMessage.ts @@ -7,6 +7,7 @@ export enum SignalMessageAction { WARNING = 'warning', TALK_STREAM_INTERRUPTED = 'talkinputstreaminterrupted', TALK_STREAM_INPUT = 'talkstream', + SESSION_READY = 'sessionready', } export interface SignalMessage {