<!--
{
  "availability" : [
    "visionOS: 26.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FoveatedStreaming",
  "identifier" : "/documentation/FoveatedStreaming/FoveatedStreamingSession/messageChannel(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foveated Streaming",
      "FoveatedStreaming"
    ],
    "preciseIdentifier" : "s:17FoveatedStreaming0aB7SessionC14messageChannel3forAC07MessageE0CSgAG2IDV_tF"
  },
  "title" : "messageChannel(for:)"
}
-->

# messageChannel(for:)

Creates or retrieves a message channel for the given message channel ID.

```
@MainActor final func messageChannel(for channelID: FoveatedStreamingSession.MessageChannel.ID) -> FoveatedStreamingSession.MessageChannel?
```

## Parameters

`channelID`

The ID of the requested message channel.

## Return Value

The requested message channel if the session is connected and the channel ID is valid, otherwise `nil`.

## Discussion

If a channel with the given ID already exists, returns the existing channel.
Otherwise, creates a new channel and opens it asynchronously.

---

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)