REST API and real time event notification - rest

I am exploring REST API, I want to know is there a way in REST to have Real time event notification to the client. I understand that REST is STATELESS protocol. One way to do this is to have client register for the interested events and poll for the same using some rest api. Is there any other way to do the say without using poll

You should try Atmosphere framework if you are trying this using Java.
It supports Jersey REST and server push.

Related

How to populate ktor server from another REST api?

I need to use an 3rd party rest api for my android app but this api requires me to use my own backend server.
So when i made a request from my app request will go to my ktor server and server should get data from another 3rd party api, how can i do that and what kinda structure should i use?
I usually prefer using ktor-client for this purposes, It is flexible, configurable and official package of ktor. I highly recommend it to you. Check the link.

how to get live data from REST API using guzzle

I'm new to whole live data broadcast. I'm creating a website on laravel 5.1, and I need to get live data from a REST API, and after making some changes, broadcast the result to my own users.
I'm using pusher to broadcast data to my clients. and I figured, I should use Guzzle and/or CURL to get data from API. but the part I don't understand is how to get live data from API? Is there an option in guzzle that will keep the connection open continuously,or should I create a job to execute guzzle code every few seconds?
I know we use websockets to create a persistent connection between the server and clients to broadcast live data. but how to create a persistent connection between API server and my server to transfer the data?
Thank you friends in advance, appreciate any help :)
It depends on an API that you are using. If it's an usual REST API, then there are no options to make a "live" catching. Only pull the API periodically.
You API provider might support webhooks, websockets or some other technologies for push model. Depends on a provider, as I said before.

is it possible to return sequential responses from asp.net web api or WCF or Restful Services?

is it possible to return multiple sequential responses with asp.net web api or WCF or any other possible REST methodologies?
So basically there will be only 1 request to a web api function and web api will return a response then couple of seconds later another response and another...
In my web api method, I'm calling lots of other functions and everytime a function completed I want to return a response and continue to the next one and return a response and continue to the next until to the end. So the client side will be informed the stage of the server side.
Note that I'm not asking something like a chat application.
Learn About ASP.NET SignalR
ASP.NET SignalR is a new library for ASP.NET developers that makes
developing real-time web functionality easy. SignalR allows
bi-directional communication between server and client. Servers can
now push content to connected clients instantly as it becomes
available. SignalR supports Web Sockets, and falls back to other
compatible techniques for older browsers. SignalR includes APIs for
connection management (for instance, connect and disconnect events),
grouping connections, and authorization.
For your scenario after the user clicks the button the action while performing its process would pass upates back to the client showing the progress of what is happening and what's done on the server side
It was indicated in the comments that the client is JS based.
Here is a ASP.NET SignalR Hubs API Guide - JavaScript Client to get started.

What is the proper way to periodically call web API from the same hosted web site

We developed web API hosted in IIS. We want to call certain APIs ourselves periodically. Ideally for simplicity of setup we want to have that code that calls API periodically also to be inside of this API. What is the best solution?
Currently we considering starting a thread in side of API to call it on timer.

Cloud Messaging or REST API?

I am using the Firebase Cloud Messaging to send message to my app. I am thinking about using is to also send data from my app to my server, but I am not sure if there is any advantage in using that over a classic HTTP REST api.
I am better of sticking with a classic HTTP api to send message from devices to server, or is using a Firebase upstream message better in some ways?
The "official" advantage of an upstream FCM message, at least on Android, would be that no additional network connection is needed, resulting in performance and battery-saving benefits, and possibly easier implementation.
Depending on how you authenticate users I see a potential simplification in the case of FCM, as you may not need a separate authentication mechanism compared to a REST API.