Closed timjrobinson closed 3 years ago
I did some further investigation and it looks like the HTTPSSEClient is connecting correctly, it's just never getting a httpclient_status
of HTTPClient.STATUS_BODY
on this line: https://github.com/GodotNuts/GodotFirebase/blob/main/addons/http-sse-client/HTTPSSEClient.gd#L70. It always gets a status of STATUS_REQUESTING
I tried both in localhost and with the hosted version of my game (You can see at https://code-breaker.puzzop.tv/) and neither are working.
I created a generic network class so that I can switch between Firestore / RealtimeDB for my game and Firestore is working in HTML5 mode.
So it doesn't seem to be a bug in the HTTPSSEClient or Networking code. I assume it's a wrong URL or params when connecting to the Realtime Database.
Yes - this is a known issue at the moment actually, and it apparently has to do with response chunking. I talked to @faless about it (the guy who maintains Godot's networking), and that's what we came up with, but I'm working on a fix and it doesn't seem to be working yet, so I may have to ping him again. In any case, this is my current task and I'm looking into it.
I have since talked to Faless again and discovered that the XMLHttpRequest (the underlying tech they use for handling HttpRequest stuff) does not support the header we're sending to initialize server-sent events. What this ultimately means is we cannot, for now, solve this problem outside of swapping to a normal HttpClient when in an HTML context, and implementing long-polling. This solution is going to take some time to implement, but I'll leave this bug open to track that work.
Okay, and Fales has managed to find a way to fix this in Godot. I don't fully understand what he did - it sounds like he implemented a completely new backend try for some stuff but I'm not sure - but mostly I just don't know when it's going to get in. I'm going to close this issue, as it's not really an issue with our plugin per se, but rather with Godot's underlying, slightly-outdated approach to networking. I do believe once Godot is fixed, it'll just fix this issue directly.
Who is Fales? Could you link to the PR for the Godot fix so I can track it and know when I can start using Realtime Database?
To my knowledge, he has not made a PR for this yet, but is hopefully going to do so within a week or two. That is based on nothing more than my own guesswork though. Fales is the maintainer for the networking stack in Godot. 😋
Describe the bug
127 is now working when running through Godot. However when exporting to HTML5 and running it, it is not receiving any
new_data_update
orpatch_data_update
signals.Updating data is working correctly with
db_ref.update(path, data)
, and thepush_successful
signal is being emitted when the data is updated.To Reproduce
Expected behavior
When initially connecting to a path with
Firebase.Database.get_database_reference("/rooms/" + room_code, {})
I expectnew_data_update
to be called upon connection. When data is changed at the specified path, I expect thepatch_data_update
signal to be sent with the chagnes.Environment:
Additional Information
I initially suspected it might be having trouble with two database connections, but this wasn't the issue. Even just directly connecting to any database path it never receives the
new_data_update
orpatch_data_update
signals.