I am using Nickel to run a REST API and I am wanting to use this approach to have a REST API that sends back "102 Progress" HTTP Status codes until it is actually ready, then sends back a 200.
The problem is that on my side, I am waiting for a user to perform some action. Once the thread knows that action was performed, our server is alerted and we can then respond to this REST request immediately with a 200 status code and go from there.
Which is great, but it then means that from the REST call, we have to be polling our own database in order to determine when this action occurred. And to some extent the whole point of this approach was to remove polling. It occurs to me that maybe with some fancy callbacks or events or someway the database knows which REST API thread to alert could know, we could respond to this user as soon as the function gets called when the user logins occurs?
Is there a way to remove that polling and instead when our separate function is called that includes the information we need to reply to the client, we automatically know from the REST request and can reply instantly?
If we can't remove this polling we'll probably just switch over to a system that calls a php script on our clients server to alert them when the user has performed the necessary action. Then let them do the callback or find a way around this.
Thank you!