<!--
{
  "availability" : [
    "visionOS: 26.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FoveatedStreaming",
  "identifier" : "/documentation/FoveatedStreaming/FoveatedStreamingSession/MessageChannel",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Foveated Streaming",
      "FoveatedStreaming"
    ],
    "preciseIdentifier" : "s:17FoveatedStreaming0aB7SessionC14MessageChannelC"
  },
  "title" : "FoveatedStreamingSession.MessageChannel"
}
-->

# FoveatedStreamingSession.MessageChannel

A bidirectional channel for sending and receiving custom data.

```
class MessageChannel
```

## Overview

Use message channels to communicate with the application streaming foveated content to your visionOS app.
You can send data with the [`sendMessage(_:)`](/documentation/FoveatedStreaming/FoveatedStreamingSession/MessageChannel/sendMessage(_:)) function and receive data through the [`receivedMessageStream`](/documentation/FoveatedStreaming/FoveatedStreamingSession/MessageChannel/receivedMessageStream) async stream.

## Topics

### Structures

[`struct ID`](/documentation/FoveatedStreaming/FoveatedStreamingSession/MessageChannel/ID-swift.struct)

A unique identifier for a message channel.

### Instance Properties

[`var channelStatus: FoveatedStreamingSession.MessageChannel.ChannelStatus`](/documentation/FoveatedStreaming/FoveatedStreamingSession/MessageChannel/channelStatus-swift.property)

The state of the message channel.

[`let id: FoveatedStreamingSession.MessageChannel.ID`](/documentation/FoveatedStreaming/FoveatedStreamingSession/MessageChannel/id-swift.property)

An identifier for the message channel.

[`let receivedMessageStream: AsyncStream<Data>`](/documentation/FoveatedStreaming/FoveatedStreamingSession/MessageChannel/receivedMessageStream)

An async stream that yields data objects each time the channel receives a message.

### Instance Methods

[`func disconnect()`](/documentation/FoveatedStreaming/FoveatedStreamingSession/MessageChannel/disconnect())

Manually disconnects and closes the data channel.

[`func sendMessage(Data) throws`](/documentation/FoveatedStreaming/FoveatedStreamingSession/MessageChannel/sendMessage(_:))

Sends data to the streaming endpoint on this channel.

### Enumerations

[`enum ChannelStatus`](/documentation/FoveatedStreaming/FoveatedStreamingSession/MessageChannel/ChannelStatus-swift.enum)

The status of a message channel.

## Relationships

### Conforms To

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

[`Observable`](/documentation/Observation/Observable)

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

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

---

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)