From: bill r. <bil...@gm...> - 2010-01-13 04:56:47
|
Hi Steve, Thanks for the reply. That's very helpful. I think that web sockets might be helpful on the backend if its simple enough, and I will look into what goes on regarding multipart POST on the front end. I certainly see and understand the value in the simpler approach. I can't really go into much detail about the situation though. In any case, we're still in prototype mode, so we're just trying out different options. Thanks again! On Tue, Jan 12, 2010 at 12:40 AM, Steve Vinoski <vi...@ie...> wrote: > > > On Mon, Jan 11, 2010 at 11:54 PM, bill robertson < > bil...@gm...> wrote: > >> Hi, >> >> I'm prototyping an application that is intended to provide an http gateway >> to a large number of machines that don't have http servers on them. When a >> get request comes in for a resource, I have Yaws picking apart the url, >> calling the machine with information about request. Because I don't want >> the remote client to send data to arbitrary clients, the remote machine will >> then make an http request back to yaws with the data. At this point the >> original request can be completed. A similar thing would occur with a put >> or post request as well, although with the data flowing in the opposite >> direction. >> >> I was originally interested in the streaming API's, but after looking at >> the information on clidata field in the Arg record, it seems like Yaws will >> read the entire contents of data sent to it by the client before calling the >> out/1 method defined in an appmod. Is that correct? Is this true for all >> methods? >> > > Seems like you have a few options: > > 1. Instead of having the backend machines making requests back to Yaws, why > not have them send replies back using whatever mechanisms you're using to > have Yaws call them? This seems fairly natural and straightforward, > especially given the ease with which protocols can be written in Erlang. > > 2. Perhaps you could use a multipart POST to send data from the backend > machines (acting as clients) to Yaws. Your yaws code can read the POST data > in chunks that way -- see the file www/upload.yaws in the source code ( > http://github.com/klacke/yaws/blob/master/www/upload.yaws). > > 3. Maybe you could use the new websockets support -- see > http://yaws.hyber.org/websockets.yaws . You'd have to have your backend > clients implement the client side of the protocol, of course. > > --steve > |