Click here to Skip to main content
15,512,456 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I am trying to develop a Web API application that is able to push updates to the clients at regular intervals in real-time.

I am not sure if this is possible as I am now quite confused between WebSockets, SignalR and Web API.

If I am approaching it the wrong way, I do hope you can point me in some direction for me to learn and try it out.

What I have tried:

I have built a simple Web API application that has the various routes that provides my data via GET request. But now I am stuck on how to trigger a push from my app to my clients, if possible.

The Web API is based on the Visual Studio template for ASP.NET Core Web API.
Updated 17-Jun-21 18:49pm

1 solution

You don't. Not using a web API anyway.

Anything over HTTP/HTTPS is a request/response. The client makes a request and the server sends back a response, typically an HTML page. A web server can NOT call up a client and just send it something whenever it wants.

You have to use something else that clients register with, like a SignalR server. That server has the capability of sending messages to clients outside of the normal web channel.
Share this answer
amsga 22-Jun-21 5:55am    
Thanks, I'll take a look at SignalR. From what I initially understand, is it all through a single socket with nothing to indicate the message type other than the contents?
Dave Kreskowiak 22-Jun-21 10:08am    

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900