Open gregoire-astruc opened 9 years ago
On the reading / parsing end of things, a potentially simpler alternative to Emscripten is using the DataView API to parse an ArrayBuffer, which can be directly extracted from an XHR2 response, as described here.
As a proof-of-concept exercise, I've written a tiny library that can help with this: https://github.com/prideout/flatbin
I wouldn't recommend using it in production since it doesn't have unit tests yet, but hopefully you get the idea from the README. One neat thing is that it can extract a typed array from a portion of the binary blob without incurring any copies. And, there's no use of Emscripten. :)
Thanks Philip.
But I see that flatbuffers now has a JS binding (don't know if you have anything to do with it) as well as enet.
I think a nodejs/iojs app is the way to for www integration.
Reading google/flatbuffers#60 made me realize we could interface with the WWW quite easily: as both enet and flatbuffers are rather plain C(++) with only system dependencies, we should be able to translate them to JS thanks to Emscripten.
Using something like node-restify, this enables us to provide a full-fledge RESTful API for more integration, given this service is just another client to the server.