<!--
{
  "availability" : [
    "iOS: 27.3.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AccessoryTransportExtension",
  "identifier" : "/documentation/AccessoryTransportExtension/AccessoryFeatureRuntimeSessionHandler",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Accessory Transport Extension"
    ],
    "preciseIdentifier" : "s:27AccessoryTransportExtension0A28FeatureRuntimeSessionHandlerP"
  },
  "title" : "AccessoryFeatureRuntimeSessionHandler"
}
-->

# AccessoryFeatureRuntimeSessionHandler

A protocol that receives events from a transport extension’s feature session.

```
protocol AccessoryFeatureRuntimeSessionHandler<Session> : Sendable
```

## Overview

Conform to this protocol in your transport extension to respond to the [`AccessoryFeatureRuntimeSession`](/documentation/AccessoryTransportExtension/AccessoryFeatureRuntimeSession) life cycle and incoming data. The system creates an instance of your type from the handler factory closure that you pass to [`makeFeatureSession(_:)`](/documentation/AccessoryTransportExtension/AccessoryTransportSession/makeFeatureSession(_:)).

A handler that serves one feature can’t serve another because each feature pins the `Session` associated type through its own `Handler` type alias (for example, [`AccessoryWorker.FeatureSession.Handler`](/documentation/AccessoryTransportExtension/AccessoryWorker/FeatureSession/Handler)).

Implement the only required method, [`sessionStarted(_:)`](/documentation/AccessoryTransportExtension/AccessoryFeatureRuntimeSessionHandler/sessionStarted(_:)), to send data.

## Topics

### Handling the session life cycle

[`func sessionStarted(Self.Session)`](/documentation/AccessoryTransportExtension/AccessoryFeatureRuntimeSessionHandler/sessionStarted(_:))

Notifies the handler when its feature session starts.

[`func sessionInvalidated(error: (any Error)?)`](/documentation/AccessoryTransportExtension/AccessoryFeatureRuntimeSessionHandler/sessionInvalidated(error:))

Notifies the handler when its feature session ends.

### Receiving data

[`func dataReceived(Data) async throws`](/documentation/AccessoryTransportExtension/AccessoryFeatureRuntimeSessionHandler/dataReceived(_:))

Handles data that the data provider extension sends.

### Associated Types

[`associatedtype Session : AccessoryFeatureRuntimeSession`](/documentation/AccessoryTransportExtension/AccessoryFeatureRuntimeSessionHandler/Session)

A session type that the handler serves.

## Relationships

### Inherits From

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sendable`](/documentation/Swift/Sendable)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)