<PackageReference Include="Grpc.Net.Client" Version="2.80.0-pre1" />

Grpc.Net.Client.Balancer.Subchannel

public sealed class Subchannel : IDisposable
Represents a logical connection. A subchannel is created with one or more addresses to equivalent servers.

A subchannel maintains at most one physical connection (aka transport) for sending new gRPC calls. If there isn't an active transport, and a call is assigned to the subchannel, it will create a new transport. A transport won't be created otherwise unless RequestConnection is called to create a transport if there isn't any.

Note: Experimental API that can change or be removed without any prior notice.

Gets the metadata attributes.

Gets the current connected address.

public void Dispose()

Disposes the Subchannel. The subchannel state is updated to Shutdown. After dispose the subchannel should no longer be returned by the latest SubchannelPicker.

Returns the addresses that this subchannel is bound to.

Registers a callback that will be invoked this subchannel's state changes.

public void RequestConnection()

Creates a connection (aka transport), if there isn't an active one.

Replaces the existing addresses used with this Subchannel.

If the subchannel has an active connection and the new addresses contain the connected address then the connection is reused. Otherwise the subchannel will reconnect.