FirebaseExtended / firebase-queue

MIT License
787 stars 108 forks source link

Implementation on direct HTTP level #87

Closed RdeWilde closed 7 years ago

RdeWilde commented 7 years ago

Did anyone ever think about a HTTP implementation for Firebase Queues directly from the client over GET-method (in a "server-less" way)?

I don't know if it is possible at all as you have all these extra factors like auth, request/response headers, encoding, connection handling etc.

Anyone got an idea about this?

daslicht commented 7 years ago

Do I understand that correct, the current implementation is meant to be used server side ?

RdeWilde commented 7 years ago

The worker is probably used serverside only. Adding tasks to the queue can be both clientside and serverside.

My question is aimed to fit the default request-response principle, where the HTTP request for a certain endpoint (url) creates a task in queue with that context and sends the payload as response once the task has been resolved - without the need of a client implementation or server.

cbraynor commented 7 years ago

Firebase Queue makes extensive use of transactions on the Firebase Realtime Database, functionality that is not exposed through the REST API, to ensure only one task makes the request. As such, it's not possible to implement a queue worker using just REST, sorry

RdeWilde commented 7 years ago

Well, technically the only thing you need is some sort of Future return for the task to be completed - and a client waiting for it. My only two concerns are: how to trick/tell the HTTP client to WAIT as the response is still incoming? How to translate the HTTP request into the queue without a server, I thought the rest interface would have some interesting features for this - maybe not.

RdeWilde commented 7 years ago

https://github.com/steida/firebase/issues/10#issuecomment-224095439

RdeWilde commented 7 years ago

Also note the possibilities from HTTP2 SSE