<!--
{
  "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/openStream(directionality:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Network"
    ],
    "preciseIdentifier" : "s:7Network0A10ConnectionCA2A4QUICVRszrlE10openStream14directionality_AE0E0Cy_qd__GAA10QUICStreamV14DirectionalityO_qd__ALXEtYaKAA05OneToI8ProtocolRd__lF"
  },
  "title" : "openStream(directionality:_:)"
}
-->

# openStream(directionality:_:)

Initiate a new data stream over QUIC. When invoked with no parameters, the default stream
type will be bidirectional. Unidirectional streams can be initiated by setting the
optional `bidirectional` parameter to false.

```
final func openStream<NewApplicationProtocol>(directionality: QUICStream.Directionality = .bidirectional, @ProtocolStackBuilder<NewApplicationProtocol> _ prepending: (QUICStream) -> NewApplicationProtocol) async throws -> QUIC.Stream<NewApplicationProtocol> where NewApplicationProtocol : OneToOneProtocol
```

## Discussion

This call will start the underlying QUIC connection if it has not been started already
and will block until the QUIC connection is ready.

The passed protocols in the `prepending` ProtocolStackBuilder will be added on top of the created QUIC Stream.

While streams can be cancelled independently of the underlying connection,
if the parent NetworkChannel is cancelled or fails, the streams will as well.

---

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)