done property
Future<void>
get
done
Resolves when the connection is finished, however it ended.
A close frame is only noticed while the incoming stream is being read, so this completes only if something is consuming messages. Awaiting it as a handler's whole body leaves the connection open until the socket dies:
await for (final message in session.textMessages) { ... }
// the loop ends when the peer closes; `done` has completed by now
Implementation
Future<void> get done => channel.sink.done;