For tutorials and more in-depth information about websuckit Channels, visit our official docs.
The following topics are covered:
Using composer
composer require websuckit/websuckit-phprequire_once 'vendor/autoload.php';
use Websuckit\WebsuckitPhp\Config;
use Websuckit\WebsuckitPhp\Websuckit;
$config = new Config($_ENV['USER_ID'], $_ENV['ACCESS_KEY'], $_ENV['PUBLIC_KEY']);
$websuckit = new Websuckit($config);You can get your USER_ID, ACCESS_KEY and PUBLIC_KEY from the websuckit dashboard.
It is possible to access a channel websocket URL by channel name, through the getConnectionUrl function
use Websuckit\WebsuckitPhp\Types\ChannelConnectionUrlConfig;
$channel = new ChannelConnectionUrlConfig('CHANNEL-NAME', 'CHANNEL-PASS-KEY', false);
$connection_url = $websuckit->getConnectionUrl($channel);$channel = $websuckit->createChannel('new-channel', 2);$channel = $websuckit->getChannel('CHANNEL-NAME');$page = "0";
$per_page = "10";
//search variable that can be null
$search = "search-term"
$channels = $websuckit->getChannels($page, $per_page, $search);$channel = $websuckit->getOrCreateChannel('CHANNEL-NAME');$channel = $websuckit->updateChannel('CHANNEL-ID', "CHANGE-CHANNEL-NAME", false, 2);$websuckit->deleteChannel('CHANNEL-ID');