laravel-websockets/src/PubSub/ReplicationInterface.php

44 lines
1014 B
PHP
Raw Normal View History

<?php
namespace BeyondCode\LaravelWebSockets\PubSub;
use stdClass;
use React\EventLoop\LoopInterface;
interface ReplicationInterface
{
/**
2019-03-25 22:37:14 +00:00
* Boot the pub/sub provider (open connections, initial subscriptions, etc).
*
* @param LoopInterface $loop
* @return self
*/
public function boot(LoopInterface $loop): self;
/**
2019-03-25 22:37:14 +00:00
* Publish a payload on a specific channel, for a specific app.
*
* @param string $appId
* @param string $channel
* @param stdClass $payload
* @return bool
*/
public function publish(string $appId, string $channel, stdClass $payload): bool;
/**
2019-03-25 22:37:14 +00:00
* Subscribe to receive messages for a channel.
*
* @param string $channel
* @return bool
*/
public function subscribe(string $appId, string $channel): bool;
/**
2019-03-25 22:37:14 +00:00
* Unsubscribe from a channel.
*
* @param string $channel
* @return bool
*/
public function unsubscribe(string $appId, string $channel): bool;
}