I am new to ASP.NET Core Razor(or MVC) page web development. I have an ASP.NET core web site deployed in a docker container and I have few other docker containers which are just .NET Core modules. Between the modules and the ASP.NET Core web page they would be talking over an RabbitMQ message bus or an Azure IOT Edge hub. Now if I get a message from one of the .NET Core module,I want to update the ASP.NET Core Index page view. I googled and I couldnt find a clear answer. Is polling using Jquery or Javascript and updating the view using Ajax the only option?
-
2SignalRuser3559349– user35593492018-01-27 05:23:38 +00:00Commented Jan 27, 2018 at 5:23
-
Thanks. That looks a interesting option. Havent used it before. So how do I populate a SignalR class when I get a message on the hub? I see the code to get the instance of the hub class in javascript, but can I do it when I get data from Queue asynchronously?appcoder– appcoder2018-01-27 05:36:50 +00:00Commented Jan 27, 2018 at 5:36
Add a comment
|
1 Answer
What you need is full duplex communication between your client (webpage) and server (asp.net core MVC).
With a classic MVC Razor webapp, communication is half-duplex; it is one way from your client to your server, and unfortunately, never the other way around.
Popular solutions that would enable what you want to achieve are:
3 Comments
appcoder
SignalR seems a best fit looking at the chat sample. Only question I have is how I get instance of the hub class to broadcast message from non hub class. lets say from the program.cs file where i register for RabbitMQ broker messages
plog17
This is another question in itself. You may post another SO question then !
appcoder
Thanks. I used the DI and got the instance of the hub.