P
P
Peter2018-06-27 17:01:26
ASP.NET
Peter, 2018-06-27 17:01:26

Is there such a thing as events in the context of ASP.NET MVC?

Good afternoon. Can you please tell me if there is an opportunity to work with events in ASP.NET MVC?
For example, there is this class:

namespace WindowsFormsApp1
{
    public delegate void GetMessage(string m);
    public class EventExample
    {
        public event GetMessage _msg;
       public void Test(string s)
       {
            if(s == "Event")
                _msg?.Invoke("Hello I`m Event:)");
       }
    }
}

Is it possible to somehow forward this event to the client? Or, ASP.NET uses other notification capabilities that I apparently don't know about yet.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Morgushin, 2018-06-27
@Morpheus_God

You want weird.
A classic web server works only on a kick from the client with a request, giving some kind of response to it.
If you want to push something from the server to the client - you need to look from the WebSockets side (correct, but rather difficult) - see here https://habr.com/post/145077/
Or periodically poll the server via ajax by the client and keep which -something static event cache, checking it on request.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question