Hi Dotan, This won't be directly useful for you, but a couple of years ago I did a port of the ObjC bindings to Objective-J (this is Javascript with Objective-C syntax). Maybe it'll at least be a helpful reference if you keep building the plain JS version.
The code is here: https://github.com/pieceable/thrift/tree/master/lib/cappuccino/Framework/Thrift And, there's a sample app here: https://github.com/pieceable/thrift-cappuccino-rails-example It uses the binary protocol over HTTP, but with the twist that the HTTP requests/responses get base64 encoded. And, because there's no byte array types in browser-side JS, it just used a regular array of numbers for the byte buffers. I think I'd start from the nodejs implementation and go from there. You're going to be able to reuse a lot of the compiler/codegen work they've done. It looks like much of their runtime library implementation will carry over, too. Best, Fred On Sunday, March 25, 2012 at 4:20 PM, Dotan N. wrote: > Hi all, > I've been examining using the javascript (_not_ node.js) version of > generated code, in order to interface with a binary protocol server (over > HTTP). > > From my initial view of the standard generated client code for javascript, > there is json serialization/deserialization built in, which won't work (and > so I verify in Thrift docs). > > So officially I saw that there is no javascript + HTTP + binary combination > that is supported. > > I started implementing such a thing myself, with > https://developer.mozilla.org/en/JavaScript_typed_arrays/DataView > as the base buffer. > > Around half an hour into that, I felt that it is a time consuming, and > possibly an error prone process. So before investing more time into it I > felt I better verify that what I want to do will even work. > > So my questions > > - why isn't there such a javascript implementation supporting binary over > HTTP? is there some kind of technical show stopper to it? (encoding is not > a problem once i set it as user-specified, then my bytes should arrive > as-is and not mangled) > - is there anything like it in the open that I can reuse (instead of > reinvent) > - coming from not knowing thrift codebase at all, is there anything to ease > the process of building one from scratch? > > > Thanks!
