Search code examples
azureeventsreal-timeazure-eventgridazure-communication-services

Does voice and video calling have javascript event listeners like the chat event listerners in Azure Communication Service?


I am currently working on a PoC communication application. I have been researching Azure Communication Service (ACS) a lot and find it a promising service to integrate into my application.

Just like real-time chatting, I want to have real-time incoming voice and video calls with ACS. I noticed this was doable with the Event Grid and SignalR, but I would like to know if it could also be done, like how they did it with real-time chatting. Reference to how chats do real-time, I found here and here.


Solution

  • That's totally possible, see the official quickstart:

    chatClient.startRealtimeNotifications();
    chatClient.on("chatMessageReceived", async (e) => {
        console.log("Notification chatMessageReceived!");
    });
    

    The model you'll get looks like this:

    export interface ChatMessageReceivedEvent extends BaseChatMessageEvent {
        /**
         * Content of the message.
         */
        message: string;
        /**
         * Metadata of the message.
         */
        metadata: Record<string, string>;
    }
    

    If you're interested in building it with .NET, you can take a look at my ASP.NET Blazor + SignalR chat sample.