Skip to content

Idle Channels

Note

This applies to the latest version of the library. If you are still using version 0.x, please refer to the migration guide.

By default, channels are initialized with an idle detection mechanism that closes the channel if no data is received or sent after a certain amount of time. This mechanism can be customized or disabled in the channel options. The default value 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.