# IConnectionMiddleware Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.runtime.messaging.iconnectionmiddleware/)

## OnConnectionAsync(ConnectionContext, ConnectionDelegate) {#onconnectionasync-microsoft-aspnetcore-connections-connectioncontext-microsoft-a-7a63b682}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.runtime.messaging.iconnectionmiddleware/methods/onconnectionasync-microsoft-aspnetcore-connections-connectioncontext-microsoft-a-7a63b682/)

```csharp
public abstract Task OnConnectionAsync(ConnectionContext context, ConnectionDelegate next)
```

Called when a connection is established. Implementations should call `next` to continue the pipeline after performing their work.

### Parameters

- `context` (`ConnectionContext`): The connection context.
- `next` (`ConnectionDelegate`): The next delegate in the connection pipeline.
