Skip to content

Idle Channels

By default, channels include an idle detection mechanism that closes the channel if no data is received or sent for a specified period of time. This mechanism can be customized or disabled through the channel options. The default idle timeout is 60 seconds.

IServiceCollection services = ...;

services.AddChannels( channel =>
{
    channel.Configure( options =>
    {
        // this is the default setting; added here just for clarity
        options.IdleTimeout = TimeSpan.FromSeconds( 60 );
    } );

    // ...
} );

To disable the idle detection mechanism, set the IdleTimeout property to TimeSpan.Zero.

Tip

The idle detection mechanism is available for all channel types: TCP, UDP, and WebSockets.