Thanks for raising this question. I will reply assuming that, in the
future, ICE will evolve to be "mobility aware", which means that new
candidates can be provided at any time and new 5-tuple can be selected
at any time without the need of an annoying SDP renegotiation. And
thus we can transition from "connected" to "disconnected" and again to
"connected".
2016-01-28 22:20 GMT+01:00 'Peter Thatcher' via discuss-webrtc
<
discuss...@googlegroups.com>:
> connected: I assume everyone needs this one.
Yes.
> completed: This means connected+"done". Do you care that it's "done" or
> not? Or do you just care if it's connected or not?
Just remove this state and we all will be happier. In fact, ICE spec
allows media (let's say DTLS or RTP/RTCP) to flow once the first
candidate pair is found (regardless the ICE controller selects another
candidate pair later). So, once media can flow we are done (at
application level).
> disconnected: This means not connected, but was previously was connected.
> Do you care that it was previously connected or not? Or does it just matter
> that it's not connected?
"disconnected" should mean (IMHO) that somehow ICE failed or was
closed so, after being "checking" or "connected", it is not
"disconnected".
Let's check another common API: WebSocket or DataChannel:
- "close" event fires when the connection fails (so it didn't ever
connect) or it is disconnected/closed.
- "error" event fires when the connection fails without previously
being connected.
I don't like this because if the connection just fails both events are
fired and it becomes hard for the app to correlate them.
> checking: This means never connected, but checking. Do you care that it's
> checking or not? If so, would you care to know if it's checking or not when
> disconnected?
"checking" should mean "not connected" but trying, regardless it was
connected before or not. That's simple.
> failed: This is the tricky one, and which we need the most input. It means
> not connected + "done", for some definition of "done" (that's the hard part
> we're trying to nail down: what does "done" mean?).
>
> - If we just removed the "failed" state altogether, would you miss it?
>
> - If we implemented "continual gathering" which would allow ICE to better
> handle switches between WiFI and Cellular (or other network changes) without
> an ICE restart, but which prevented the "failed" state from being permanent
> (until an ICE restart), which would you choose? The failed state being
> permanent (until an ICE restart), or the better network behavior without ICE
> restarts?
>
> - If a PeerConnection went to "failed" and then later become "connected",
> would that be a good thing or a bad thing for your application?
>
> - If knowing ICE were "done" required signalling a new event/message, would
> you bother hooking up to the event and sending the new message and pushing
> it down with the new method? Or would it be too much trouble than it's
> worth?
"failed" should not exist (in case we have continual gathering).
IMHO we need:
- "checking": It was connected or not, but now it is trying to connect.
- "connected": ICE connected and media can flow.
- "disconnected": If it was "connected" then this means that the
chosen pair has suddenly failed (ICE consent, ICE TCP closed, etc). If
it was not "connected" then this means that all the candidate pairs
were tested and failed. When "disconnected" fires it should be
expected that "checking" is fired again (if there are reasons to try
again).
Also, "disconnected" should be fired with a "reason" or "cause"
attribute in the corresponding Event object.
- "closed": The user called stop().
> - If we redefine what ICE connection states mean and when they change, how
> much difficulty will it be for you to change your application to match the
> new meanings?
The current states are not easy to manage.
--
Iñaki Baz Castillo
<
i...@aliax.net>