<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Network",
  "identifier" : "/documentation/Network/NetworkConnection/inboundStreams(prepending:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Network"
    ],
    "preciseIdentifier" : "s:7Network0A10ConnectionCA2A4QUICVRszrlE14inboundStreams10prepending_yqd__AA10QUICStreamVc_yAE6StreamCy_qd__GYaYbKYActYaKAA05OneToI8ProtocolRd__lF"
  },
  "title" : "inboundStreams(prepending:_:)"
}
-->

# inboundStreams(prepending:_:)

Handle inbound streams and provide a closure on which callback handlers will be executed.
When the `NetworkConnection<QUIC>` state moves to `ready`, the internal listener is registered with the system
and can receive incoming streams on the multiplexing instance.
`inboundStreams` should only be called once on a `NetworkConnection<QUIC>`, and multiple calls to run will
throw an exception.

```
final func inboundStreams<NewApplicationProtocol>(@ProtocolStackBuilder<NewApplicationProtocol> prepending: @escaping (QUICStream) -> NewApplicationProtocol, _ handler: @escaping @isolated(any) @Sendable (QUIC.Stream<NewApplicationProtocol>) async throws -> Void) async throws where NewApplicationProtocol : OneToOneProtocol
```

## Discussion

If the `NetworkConnection<QUIC>` is not started at the time that `inboundStreams` is invoked, it will be started.

The passed protocols in the `prepending` ProtocolStackBuilder will be added on top of the inbound streams.

The closure inherits the isolation domain of the caller.

---

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)