2018-11-21 11:13:40 +00:00
|
|
|
<?php
|
|
|
|
|
|
2020-09-10 19:59:26 +00:00
|
|
|
namespace BeyondCode\LaravelWebSockets\Channels;
|
2018-11-21 11:13:40 +00:00
|
|
|
|
2020-09-10 19:59:26 +00:00
|
|
|
use BeyondCode\LaravelWebSockets\Server\Exceptions\InvalidSignature;
|
2020-09-02 12:06:28 +00:00
|
|
|
use Ratchet\ConnectionInterface;
|
|
|
|
|
use stdClass;
|
2018-11-22 09:54:51 +00:00
|
|
|
|
2018-11-21 11:13:40 +00:00
|
|
|
class PrivateChannel extends Channel
|
|
|
|
|
{
|
2020-09-02 12:06:28 +00:00
|
|
|
/**
|
|
|
|
|
* Subscribe to the channel.
|
|
|
|
|
*
|
|
|
|
|
* @see https://pusher.com/docs/pusher_protocol#presence-channel-events
|
|
|
|
|
* @param \Ratchet\ConnectionInterface $connection
|
|
|
|
|
* @param \stdClass $payload
|
2020-09-19 11:16:26 +00:00
|
|
|
* @return bool
|
2020-09-02 12:06:28 +00:00
|
|
|
* @throws InvalidSignature
|
|
|
|
|
*/
|
2020-09-19 11:16:26 +00:00
|
|
|
public function subscribe(ConnectionInterface $connection, stdClass $payload): bool
|
2020-09-02 12:06:28 +00:00
|
|
|
{
|
|
|
|
|
$this->verifySignature($connection, $payload);
|
|
|
|
|
|
2020-09-19 11:16:26 +00:00
|
|
|
return parent::subscribe($connection, $payload);
|
2020-09-02 12:06:28 +00:00
|
|
|
}
|
2018-12-04 21:22:33 +00:00
|
|
|
}
|