RE: [websockets] Binary support changes

On Friday, May 27, 2011 4:23 PM, Jonas Sicking wrote:
> However, I think there might be another solution to this whole
> situation. There really is no reason that only binary data can be
> received as a Blob. Getting data as a Blob is useful any time you're
> dealing with a large chunk of data where you're not immediately going
> to process all (or even any) of the data. Hence it would make sense to
> allow also text data to be received in the form of a Blob.
> 
> So maybe a better solution is to simply add a boolean flag which
> indicate if data should be received in a "plain" format (strings for
> textual data, ArrayBuffer for binary), or as a Blob (which would have
> its .type set to "text/plain;charset=utf8" or "" depending on if it's
> textual or binary).

I don't really like this idea. I don't want to have to change the way
I read text messages just because I want binary data as a Blob. One of
the scenarios are planning for is a text message that contains meta data
about subsequent binary messages that will be treated as Blobs. Your
proposal would require extra complexity to read text from a Blob or
switch back and forth.

Adrian.

Received on Saturday, 28 May 2011 00:34:04 UTC