Reputation: 854
I'm writing a program that I'd like to be able to compile natively and compile with Emscripten. I need to make synchronous HTTPS requests as part of that program.
How do I do that in C++? The Javascript side makes sense, but I don't know what compiles to the XMLHttpRequest
.
Upvotes: 2
Views: 2234
Reputation: 4410
There are a few answers to your question:
emscripten_async_wget
but the kicker is that you can't easily make a synchronous call from XMLHttpRequest and get back binary data. Firefox OS will disallow that if the mime type specifies binary data. However, you can override the mime type and convert the resulting text into a typed array yourself. It's the same technique as the hack in this link.
At first glance this sounds like a perfect solution, but if you are receiving a lot of data back, you will have to convert that character array into a typearray and that is slow.
Upvotes: 2