Skip to content

Channel Events

Channels provides a way to monitor certain events that occur during a channel's lifetime. This can be useful for logging, metrics or any other specific scenarios. The following events are available:

  • Channel Created
  • Channel Closed
  • Data Received
  • Data Sent

To monitor channel events, you'll need to create a class that implements the IChannelMonitor interface and then add it to the DI container. You can register as many different implementations as you need and it's up to you whether you register them as singleton, scoped (channel bound) or transient services.

public class MyChannelMonitor : IChannelMonitor
{
    // ...
}

// ...

IServiceCollection services = ...;

services.AddSingleton<IChannelMonitor, MyChannelMonitor>();