Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Realtime updates (not an issue, just easiest way to point something out) #79

Open
WolfgangSenff opened this issue May 29, 2024 · 0 comments

Comments

@WolfgangSenff
Copy link

WolfgangSenff commented May 29, 2024

Howdy folks,

I've been working on a very similar implementation for the Godot game engine, as I'm the creator of the main Firebase library for said engine use. I noticed a message from Samuel Elgozi here:

https://groups.google.com/g/firebase-talk/c/WpfsvysNFCU/m/GArEBbyEBAAJ

When I saw it, it looked very familiar to me. I noticed however that I believe there's a typo in it due to the very weird shape of the API for Firestore.Listen. Essentially, I've come to the conclusion in my own experiments that it has to look like this:

var body = {
  "addTarget": {
    "documents": {
      "documents": ["projects/%s/databases/(default)/documents/%s/%s" % [project_id, collection_path, document_id]]
    }
  }
}

You can ignore all the %s and just ensure that they are replaced in your version with the appropriate values to the right, the above is just how my implementation substitutes those values into the string.

It's pretty bizarre, but what I noticed is that there's a documents object that has a child node named documents array. I've gotten mine working to the point that I do receive a response from the servers, but for some reason, it never returns any actual content, even though I've perfectly modeled my request after inspecting a valid request from a web app using Chrome dev tools. I'm not really sure what's different, but I figure if you're using web, you might well be able to figure out exactly what's wrong if the body json is formatted correctly and be able to help me in turn. (The above isn't necessarily going to work for you, as I noticed it seems to be pretty weird about which headers are sent, and I'm not sure if my "auth bearer" and "content type json" are enough for that. It seems like they must not be, and I suspect it doesn't accept json as an endpoint, because the valid web request I made encodes the body as an x-www-form-urlencoded query string and sends that as the body.)

Anyway, I hope this might be helpful! If it's not, sorry for opening an issue, was the only easy way I could find what I know to be the right person/group responsible for the library!

P.S. I just learned that the reason it doesn't work in Godot yet is because the HTTPClient does not support HTTP2! Doh! Guess I'll either open a proposal or get someone else to on that repo. I still hope this helps! I guess you should not have the HTTP2 problem. :P Note you may also have to pass the pseudo-headers required for it, not sure if your system will do it automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant