Internal Channel
An internal channel wraps an internal transport and provides a higher-level API for sending and receiving messages between device parts. Additionally, it exchanges messages on the same device part, for example between multiple components.
The internal channel is available from the Context and can be used by components and other framework code.
See internal::Channel for full API details.
Sending
Sending messages to other device parts is done by calling the send method on the internal channel:
rust
context.internal_channel.send(message).await;Receiving
Receiving messages from other device parts, as well as from the same device part, is done by creating a receiver instance by calling the receiver method on the internal channel, and then calling the next method on the receiver:
rust
let mut receiver = context.internal_channel.receiver::<MyMessageType>()?;
let message = receiver.next().await;