Async_Load Reading HTTP Stream

Sammi3

Member
I'm trying to connect to a Firebase Realtime database using their RESTApi. To get realtime data from it, I have to send a http_get request with the header Accept being equal to 'text/event-stream'

Here's how I did it:
Code:
var url, header, payload, _session;
url = "https://[DATABASE]/servers.json";
header = ds_map_create();
header[? "Accept"] = "text/event-stream";
httpRequest = http_request(url, "GET", header, "");
//destroy payload and header maps
ds_map_destroy(header);
The problem is, in the async_http event, the data is constantly being downloaded so I can't access it. I just get a status code of 1. Is there a way of reading http streaming data?

Also, according to the real time database, it returns http_status code 307 which is a redirect. Could this be the issue?
 

FrostyCat

Redemption Seeker
Not with the current built-in functions. A status code of 1 in the HTTP event simply means a download in progress, which for a stream is always the case until you stop listening in. You will need to write a native extension to support this.
 
Top