---
title: "messageChannel(for:)"
framework: foveatedstreaming
role: symbol
role_heading: Instance Method
path: "foveatedstreaming/foveatedstreamingsession/messagechannel(for:)"
---

# messageChannel(for:)

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

## Declaration

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

## Parameters

- `channelID`: The ID of the requested message channel.

## Return Value

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

## Discussion

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