MphpD
v1.2.6 Documentation GitHub

# Channel

This subclass is used for client-to-client communication over MPD

    MphpD::channel(string $name) : Channel

## Methods

### __construct

This class is not intended for direct usage. Use `MphpD::channel()` instead to retrieve an instance of this class.

    Channel::__construct(FloFaber\MphpD\MphpD $mphpd, string $name) : mixed

#### Parameters

- ##### $mphpd

- ##### $name

#### Returns `mixed`

### subscribe

Subscribe to the channel.

    Channel::subscribe() : bool

#### Parameters

None.

#### Returns `bool`

bool `true` on success or `false` on failure.

### unsubscribe

Unsubscribe the channel.

    Channel::unsubscribe() : bool

#### Parameters

None.

#### Returns `bool`

bool `true` on success or `false` on failure.

### read

Returns a list of the channel's messages.

    Channel::read() : mixed

#### Parameters

None.

#### Returns `mixed`

array|false `array` containing the messages on success or `false` on failure.

### send

Send a message to the channel.

    Channel::send(string $message) : bool

#### Parameters

- ##### $message

  The message text.

#### Returns `bool`

bool `true` on success or `false` on failure.

© 2023 Florian Faber