Re: [websockets] structured clones

On Wed, 09 Sep 2009 21:49:07 +0200, Jonas Sicking <jonas@sicking.cc> wrote:
> Yes, you need to serialize. But you can serialize using whatever
> format you want for web storage.

I know. That's why I'm asking about Web Sockets in relation to work  
needing to be done for Web Storage and not just about Web Storage.


>> If the format for Web Sockets is
>> clear maybe we have to only worry about the serialization of structured
>> clones once.
>
> True, once an implementation writes the code for websockets you could
> then reuse that for localStorage. However there is a good reason not
> to. Say that someone stores an object like:
>
> {
>   hello: "bar",
>   theFile: myFile
> }
>
> where 'myFile' is a File object. In this case you'll probably want to
> store the file object separately. This way when data is read out of
> localStorage, you won't need to read in the file data. Instead you
> just serialize a pointer to where the file data is stored, and then
> when deserializing, create a File object that reads (asynchronously)
> from that location.

Sure. Some things might be better done in a different way. The  
specification for Web Storage cannot require the serialization format one  
way or another anyway so that does not matter much.

Anyway, this was supposed to be a very simple request. If it's not clear  
then lets drop it. Changing some serialization code later on shouldn't be  
much of a problem.


-- 
Anne van Kesteren
http://annevankesteren.nl/

Received on Wednesday, 9 September 2009 20:00:53 UTC