> For the complete documentation index, see [llms.txt](https://venndev.gitbook.io/vapm/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://venndev.gitbook.io/vapm/coroutinegen/channel.md).

# Channel

The Channel class is used to synchronize concurrent tasks from CoroutineGen.

**Interface**

```php
 /**
  * @param mixed $message
  * @return Generator
  *
  * This function is used to send a message to the channel.
  */
 public function sendGen($message): Generator;

 /**
  * @param mixed $message
  * @return void
  *
  * This function is used to send a message to the channel.
  */
 public function send($message): void;

 /**
  * @param callable $callback
  * @return Generator
  *
  * This function is used to receive a message from the channel.
  */
 public function receiveGen(callable $callback): Generator;

 /**
  * @param callable $callback
  * @return void
  *
  * This function is used to receive a message from the channel.
  */
 public function receive(callable $callback): void;

 /**
  * @return bool
  *
  * This function is used to check if the channel is empty.
  */
 public function isEmpty(): bool;

 /**
  * @return void
  *
  * This function is used to close the channel.
  */
 public function close(): void;

 /**
  * @return bool
  *
  * This function is used to check if the channel is closed.
  */
 public function isClosed(): bool;
```
