-
Notifications
You must be signed in to change notification settings - Fork 42
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
Chunked decoding #6
Comments
My bad, here's the source. |
Glad to hear you're working on this! First a question for you: you said you're using the To answer your question: the basic way I was thinking this would work would be to break |
@lukewagner Very helpful, thanks for the info. 👍 I suspect you're right about I think WebSockets is the ideal distribution protocol, but the best first step IMO is to implement something as basic as possible, which is compatible with all HTTP servers. That would make adoption pain-free. I'll do some testing & research on the following things:
|
Great! I'd also check other browsers on whether they pass strings containing the binary data (is it base64 encoded?) to |
The strings Firefox passed to Note to self: also try |
Hey @lukewagner et al, I've been experimenting with chunked decoding and I have some questions.
My experimental setup is using the
onprogress
event ofXMLHttpRequest
for mid-transfer control. This is working well. I suspect WebSockets might be a better way to serve this stuff, but I'm looking at XHR first because it requires less up-front setup (every webserver supports GET, but ws:// takes more work). Anywho, on to the questions.Currently, the polyfill downloads the complete binary, then unpacks it. Unpacking involves a couple of mallocs and then a call to
_asmjs_unpack
.One malloc reserves space for the incoming bytes. No problem here, we've got access to the total bytes as early as the first
onprogress
event. There's another malloc that has me concerned, though. It reserves space for the unpacked asmjs code, as determined by_asmjs_unpacked_size
. Since I'm not sure how that function works, I'm not sure we can malloc that space before the download is complete (how does it know?). Perhaps it uses some theoretical maximum size of asmjs that can be generated by a given number of wasm bytes?Beyond the mallocs, I need some guidance on how
_asmjs_unpack
is going to work when unpacking an incomplete binary, a little bit at a time. The incoming binary slices will be at arbitrary positions, so_asmjs_unpack
(or a wrapper function) will need to intelligently handle things like partial opcodes, opcode without args, etc. Without source or docs, it's hard to know what to expect.My questions all boil down to this: what steps should be taken during each
onprogress
tick? and where can I find source or docs for the_asmjs_*
functions?The text was updated successfully, but these errors were encountered: