My bad, I missed the custom calc example. My suggestion on examples is that they lack brevety =) even more now that you outlined that they show optional steps.
For the functions sent as arguments, I checked out bellhop's code and dnode's as well. bellhop does static analysis on the function it has to send with toString [1] and sends the body of the function over the wire. This forces the function being serialized to be self-contained -> no closured variables. However this allows the code execution to be done on the server side. in dnode, when sending functions as arguments, it gives this function an id and this id is sent over the wire with an indication that it represents a function. The receiver of such an argument generates a shim to be used by the consumer of the API. When this shim is called the id is resent over the wire. Upon reception of that ID, the corresponding function is executed locally. This allows the use of closured variables but it forbids remote execution of code. Both are different approaches to this =) My original concern was that the examples didn't have this "it just works" feeling that I had when reading dnode. I'm in no way questionning the functionality or the usefulness of bellhop ! [1] https://github.com/mscdex/bellhop/blob/master/lib/utils.js#L63 On Monday, 18 November 2013 14:30:53 UTC+1, mscdex wrote: > > On Monday, November 18, 2013 4:30:03 AM UTC-5, Floby wrote: >> >> My remark concerning the complexity of the examples is that setting up an >> RPC link between to nodes involves a lot of steps >> >> - add methods >> >> You can add() an object or array of functions too. > > >> >> - generate RPC shim >> >> This isn't required, you can use .send() directly if you wish. generate() > is there for convenience. > > >> >> - connect to server >> >> This is just due to the nature of the module -- they're just generic > (transform) streams. So in this way it's pretty much the same as dnode, > minus dnode's 4 line listen() wrapper around net.createServer().listen() > and 4 line connect() wrapper around net.connect(). IMHO calling > net.createServer() or http.createServer() for example does not take much > code/effort. > > If you think the examples are missing something in particular, I'm open to > suggestions. > > >> >> - use shim >> >> Again, optional as noted previously if you use .send() directly. > > Dnode can also send functions as results, but maybe that's what you >> incluce in non-JSON types. However it doesn't seem from the example that >> bellhop can do it >> > > Huh? I thought the first example in the readme already showcased this > somewhat. In particular a Date object is passed from server to client and > also a function is sent to the server and executed server-side (albeit > within the same process for simplicity). > > Also I've taken a peek at more of dnode's code along with dnode-protocol > and jsonify and cannot seem to find where it's sending non-JSON values such > as functions over the wire. > > -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
