PHP code example of hsk99 / push-client
1. Go to this page and download the library: Download hsk99/push-client library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hsk99 / push-client example snippets
// 非 webman 运行,设置配置参数
\Hsk99\PushClient\Client::setConfig([
'service_domain' => 'http://127.0.0.1:8789', // 服务域名
'access_key' => 'ecc1dcdecd380a38cadc74cd9d0fb9bf', // 访问密钥
'secret_key' => '8af1ea94d8f73d5cc9ba384b59298c41', // 密钥
'log_path' => null, // 日志目录
]);
// 私有频道鉴权
\Hsk99\PushClient\Client::connectAuth('socket_id', 'my-channel');
// 订阅发布
\Hsk99\PushClient\Client::channelPublish('my-channel', 'my-event', 'data');
// 在线订阅channel列表
\Hsk99\PushClient\Client::channelList();
// 在线订阅channel详情
\Hsk99\PushClient\Client::channelInfo('my-channel');