Re: Lazy Blob

On Wed, Aug 1, 2012 at 11:13 AM, Florian Bösch <pyalot@gmail.com> wrote:

> On Wed, Aug 1, 2012 at 6:51 PM, Glenn Adams <glenn@skynav.com> wrote:
>
>> I'm questioning defining a "LazyBlob" that is solely usable with XHR. It
>> would be better to have a more generic version IMO.
>>
> Websockets have no content semantics, therefore any lazy content
> negotiating reader cannot deal with websockets unless an additional
> application layer protocol and implementation on the server side is
> introduced, something that does not exist for websockets otherwise. You
> could for instance implement HTTP over websockets to get the content
> semantics, and if your server gets a websocket request, it could be proxied
> to a domain socket which happend to have a webserver listening which would
> understand the HTTP request and deliver the resource/range.
>
> Now instead of implementing HTTP over websockets over HTTP over sockets,
> you could just use XHRs which implement HTTP over sockets. Which is why
> generalising lazy readers to websockets does not make sense.
>

Given the "Simple approach" suggested by DAR:

partial interface BlobBuilder {
>     Blob getBlobFromURL (DOMString url);
> };
> Usage:
> var bb = new BlobBuilder()
> ,   blob = bb.getBlobFromURL("http://specifiction.com/kitten.png");


I don't see why the following isn't feasible:

blob = bb.getBlobFromURL("ws://specifiction.com/image/kitten.png<http://specifiction.com/kitten.png>
")

Or, given the "Using XHR for Options" approach:

partial interface BlobBuilder {
>     Blob getBlobFromURL (XMLHttpRequest xhr);
> };
> Usage:
> var bb = new BlobBuilder()
> ,   xhr = new XMLHttpRequest();
> xhr.open("GET", "/kitten.png", true);
> xhr.setRequestHeader("Authorization", "Basic DEADBEEF");
> var blob = bb.getBlobFromURL(xhr);


why one couldn't have:

partial interface BlobBuilder {
    Blob getBlobFromURL (WebSocket ws);
};

var bb = new BlobBuilder()
,   ws = new WebSocket("ws://specifiction.com/image<http://specifiction.com/kitten.png>
");
ws.onopen = function(){ws.send("kitten.png");}
var blob = bb.getBlobFromURL(ws);

Received on Wednesday, 1 August 2012 17:57:53 UTC