Any sample code in C/C++ to Publish and Subscribe to Azure Web PubSub?

Williams Celis 30 Reputation points
2024-05-01T10:49:20.29+00:00

I am looking for sample C/C++ code to Publish and Subscribe to Azure Web PubSub. Specifically, I want to send data from a microcontroller programmed in C/C++ to a server with Azure Web PubSub. Are there any resources available that could help me achieve this?

Azure Web PubSub
Azure Web PubSub
An Azure service that provides real-time messaging for web applications using WebSockets and the publish-subscribe pattern.
66 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,559 questions
0 comments No comments
{count} votes

Accepted answer
  1. Gowtham CP 1,090 Reputation points
    2024-05-01T10:53:22.6333333+00:00
    • Set up an Azure IoT Hub instance in your Azure portal and register your microcontroller as a device in the Azure IoT Hub.
    • Integrate the Azure IoT Hub Device SDK for C into your microcontroller project. This SDK facilitates establishing a connection with Azure IoT Hub, enabling your microcontroller to send messages (publish) to Azure IoT Hub.
    • Create an Azure Function or Azure Web App to serve as a bridge between Azure IoT Hub and Azure Web PubSub. Configure it to receive messages from Azure IoT Hub and forward them to Azure Web PubSub for broadcasting.
    • Subscribe to the Azure Web PubSub service in your web application or client to receive messages sent from the Azure Function or Web App.

    By following these steps and utilizing the provided resources, you can seamlessly integrate your microcontroller with Azure Web PubSub via Azure IoT Hub.

    Useful resources:

    I hope this helps!


1 additional answer

Sort by: Most helpful
  1. Gowtham CP 1,090 Reputation points
    2024-05-02T07:53:29.8066667+00:00

    Hello @Williams Celis

    For real-time video streaming with microcontrollers on Azure, consider these options:

    Azure Media Services: Ideal for encoding, packaging, and delivering video content to various devices.

    Azure IoT Edge: Deploy cloud workloads to microcontrollers for local video processing, reducing latency and bandwidth usage.

    Azure IoT Hub with Azure IoT Edge: Establish end-to-end video streaming solutions, with IoT Hub managing device-cloud communication and IoT Edge enabling local processing.

    Azure Media Services Live Video Analytics: Extract insights from live video streams in real-time, enhancing functionality with tasks like object detection and face recognition.

    1 person found this answer helpful.