release method

void release(
  1. RpcEndpointBase endpoint
)

Drops endpoint and closes it, which is what disposes its contracts, then runs its onRelease. Idempotent.

Implementation

void release(RpcEndpointBase endpoint) {
  if (!_live.containsKey(endpoint)) return;
  final onRelease = _live.remove(endpoint);
  unawaited(
    endpoint.close().catchError((Object e) {
      _log.warning('Error closing an endpoint on disconnect: $e');
    }),
  );
  if (onRelease != null) {
    notifyWithoutDying('onConnectionClosed', onRelease, logger: _log);
  }
}