Re: Improvements suggestion for DataChannels

On 3/3/2014 8:06 AM, Martin Thomson wrote:
> On 3 March 2014 04:18, Adam Bergkvist <> wrote:
>> I still think that's strange API behavior.
> I don't see any strangeness here.  If I have a reference, then the
> object is not garbage collected.  If not, then not.

Agree with Martin.  It seems totally normal - things stay alive 
(accessible) so long as they're referenced.  Telling it to close() 
disconnects it, but the object exists so long as the reference exists.

The only way that channel lifetimes are a little bit surprising is that 
open channels (like in WebSockets) stay alive so long as their 
onmessage/etc handlers have functions attached to them, depending on state.
And we have the same issues.

So if someone is holding a reference, the channel can be closed.  If 
it's closed, then when you drop the reference it will be GC'd (when the 
system feels like).

Randell Jesup -- rjesup a t mozilla d o t com

Received on Monday, 3 March 2014 14:17:01 UTC