Firebase REST streaming

I am building a chat app using firebase. It works in Javascript but causing me a lot problem in performance and interaction on the interface using it in a webview. I try to change the chat to LUA. I can get data from firebase and can send data to the firebase using their REST service.

Here is the problem:

I need to listen to the changed data. And I need to use the REST streaming. I could not find any example on how corona can do it. Can someone help?

Use something like POSTMAN or Fiddler to test your calls and then replicate those exact calls in Lua using the network.* library. If you’re having trouble doing that, post your calls here in the forum compared with the call that you’re trying to make and we can help.

I need EventSource / Server-Sent Events protocol. But I can’t see the network library support this thing.

Here is the firebase REST API I want to use:

https://www.firebase.com/docs/rest/api/#section-streaming

According to the firsbase REST API, I should be the following:

  1. Set the client’s Accept header to text/event-stream
  2. Respect HTTP Redirects, in particular HTTP status code 307
  3. Include the auth query parameter if the Firebase location requires persmission to read

I think I know how to handle #3. But I don’t know if the corona network API can be #1 and #2.

Use something like POSTMAN or Fiddler to test your calls and then replicate those exact calls in Lua using the network.* library. If you’re having trouble doing that, post your calls here in the forum compared with the call that you’re trying to make and we can help.

I need EventSource / Server-Sent Events protocol. But I can’t see the network library support this thing.

Here is the firebase REST API I want to use:

https://www.firebase.com/docs/rest/api/#section-streaming

According to the firsbase REST API, I should be the following:

  1. Set the client’s Accept header to text/event-stream
  2. Respect HTTP Redirects, in particular HTTP status code 307
  3. Include the auth query parameter if the Firebase location requires persmission to read

I think I know how to handle #3. But I don’t know if the corona network API can be #1 and #2.

I am trying to use REST streaming with Firebase and Corona SDK now. Did you ever figure out how to get it working?

no…I don’t have solution yet…what i can do is to keep calling firebase every second which is a really bad workaround

I am trying to use REST streaming with Firebase and Corona SDK now. Did you ever figure out how to get it working?

no…I don’t have solution yet…what i can do is to keep calling firebase every second which is a really bad workaround