Code Monkey home page Code Monkey logo

Comments (7)

olivierbloch avatar olivierbloch commented on July 20, 2024

Hi @jeywinlizy
The Azure IoT Suite Remote Monitoring dashboard is an ASP.Net MVC app and you can find the code here: https://github.com/Azure/azure-iot-remote-monitoring
You'll see that it is using an event processor host to get Device to Cloud messages.
If you are looking for a little bit simpler example of an ASP.Net app (not MVC) you can also check out this project: http://connectthedots.io

from azure-iot-sdk-csharp.

jeywinlizy avatar jeywinlizy commented on July 20, 2024

Thanks @olivierbloch . I shall have a look on that and try.

from azure-iot-sdk-csharp.

olivierbloch avatar olivierbloch commented on July 20, 2024

Hi @jeywinlizy
Shall we close this "issue" considering it is not an issue?
Thanks

from azure-iot-sdk-csharp.

jeywinlizy avatar jeywinlizy commented on July 20, 2024

Hi @olivierbloch
I went thru' the code at a higher level. It looks like you have used Storage Table in your app.
My understanding is that the device sent messages are inserted to the Storage Tables, from where the message are retrieved as per the updated time stamp to display the message on the View(web page).

Is my understanding correct?

It would really be helpful if you can help me with the details of sequence of actions taking place to Receive the message from IOT Hub and displaying continuously on the web page.

As per my code I am calling Receive method
EventData eventData = await eventHubReceiver.ReceiveAsync();

After this call , what & how next ==> I would like to know how to take it next to display the message continuously on the View; as the message is being received on the device in the IOT hub

My requirement is to get the message from IoT HUb and keep displaying continuously on the View.

Kindly suggest on how to take this forward. Thanks in advance.

from azure-iot-sdk-csharp.

olivierbloch avatar olivierbloch commented on July 20, 2024

Hi @jeywinlizy
You are actually right for the Remote Monitoring dashboard (which I don't own and don't know all the details about).
In the ConnectTheDots project I am not using the MVC model, but I leverage WebSockets to stream the data update to the browser client from the ASP.Net site backend.

from azure-iot-sdk-csharp.

jeywinlizy avatar jeywinlizy commented on July 20, 2024

Thanks @olivierbloch .
From your suggestion I was looking into the webSocket to implement my solution.

I have the Receive method in a page as below that receives the message from IotHub.

private static async Task ReceiveMessagesFromDeviceAsync(string partition, CancellationToken ct)
        {
            var eventHubReceiver = eventHubClient.GetDefaultConsumerGroup().CreateReceiver(partition, DateTime.UtcNow);
            while (true)
            {
                if (ct.IsCancellationRequested) break;
                EventData eventData = await eventHubReceiver.ReceiveAsync();
                if (eventData == null) continue;

                string data = Encoding.UTF8.GetString(eventData.GetBytes());
               
                Console.WriteLine("Message received. Partition: {0} Data: '{1}'", partition, data);

            }
        }

the above variable data gets the message sent by the IoTHub

  1. Kindly help me here--- after this how should I pass\link this message in the var data to be displayed on the web page using the Websocket?
  2. What should be the url and protocol that I need to pass to the Websocket in my js?
    I have the below in the js file
    socket = new WebSocket(url, "echo-protocol");
  3. Where should I notify about my IotHub Connection string?

Kindly help me with these details so that I can update my app and make it up and complete --- which would be able to display the message sent from device in Iot Hub in the web page.

from azure-iot-sdk-csharp.

olivierbloch avatar olivierbloch commented on July 20, 2024

Hey @jeywinlizy
unfortunately I am not the WebSocket expert and can't help you further on this very topic. All I have a know is in the ConnectTheDots.io project.
Additionally, considering this is not an issue related to our SDKs, I will close this thread,
I would suggest you post the question on StackOverflow to ensure the right people can help you out.

from azure-iot-sdk-csharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.