How to use Azure Digital Twins with WebXR?

Adwait Naik 40 Reputation points
2024-04-22T16:01:35.71+00:00

My Digital Twin is a 3D model of .glTF format. I realised that it will not serve the purpose of communicating with the real device for telemetry exchange. Is there a way to use the azure digital twins on WebXR platform?

Azure Digital Twins
Azure Digital Twins
An Azure platform that is used to create digital representations of real-world things, places, business processes, and people.
220 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sander van de Velde 29,271 Reputation points MVP
    2024-04-22T17:51:31.5433333+00:00

    Hello @Adwait Naik ,

    welcome to this moderated Azure community forum.

    Microsoft Azure Digital Twins as an environment for keeping the latest state of digital twins.

    Using custom logic in Azure Functions or Logic Apps data can be ingested into the environment.

    The true value are the relationships helping event to travel through the environment, from twin to twin (again using custom logic).

    By default, Microsoft offers 3D Scenes Studio to visualize the twin environment but you can your own visualization like WebXR.

    WebXR works withi the browser and needs to be triggered with telemetry/digital twin updates.

    Luckily, the ADT environment exposes any Digital Twin changes via 'endpoints'.

    Routing event notifications from Azure Digital Twins to downstream services or connected compute resources is a two-step process: create endpoints, then create event routes to send data to those endpoints.

    So you need to create an endpoint (eg. to EventGrid, EventHub, or Service bus) and route message towards it:

    User's image

    Next, to update the WebXR logic in the browser, I recommend using WebSockets or SignalR.

    An Azure Function forwards the message then.

    So you need a service like Azure Web PubSub or Azure SignalR Service.

    These services can route messages to logic running in browsers when there is client code running in that browser.

    An example of a SignalR client is shown here.

    Finally, your flow will probably look like:

    Azure Digital Twins environment ->
    Route to Digital Twins change events (Event Hub) endpoint ->
    Event Hub receiving and publishing events ->
    Azure Function subscribed to change events, outputting them to a SignalR service ->
    SignalR service sends all incoming messages to clients running in browsers ->
    Client logic in browser manipulates your WebXR model with incoming event
    

    Yes, there are multiple (little) steps needed to get this working but this must be doable for a regular developer.

    Success!


    If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.

    0 comments No comments