50 lines
1.4 KiB
PHP
50 lines
1.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace app\admin\controller\test;
|
|
|
|
use app\common\controller\Backend;
|
|
use app\common\library\admin\WebSocketConfigHelper;
|
|
use support\Response;
|
|
use Webman\Http\Request as WebmanRequest;
|
|
|
|
/**
|
|
* WebSocket test for period status stream.
|
|
*/
|
|
class GameCurrentStatus extends Backend
|
|
{
|
|
protected ?object $model = null;
|
|
|
|
public function wsConfig(WebmanRequest $request): Response
|
|
{
|
|
$response = $this->initializeBackend($request);
|
|
if ($response !== null) {
|
|
return $response;
|
|
}
|
|
|
|
$subscribeTopics = [
|
|
'period.tick',
|
|
'period.opened',
|
|
'period.locked',
|
|
'period.payout',
|
|
'bet.accepted',
|
|
'wallet.changed',
|
|
'auto.spin.progress',
|
|
];
|
|
|
|
return $this->success('', [
|
|
'name' => 'ws.period',
|
|
'ws_url' => WebSocketConfigHelper::wsUrl($request),
|
|
'connect_tip' => 'After connected, topics are auto-subscribed. You can also send subscribe manually.',
|
|
'subscribe_topics' => $subscribeTopics,
|
|
'sample_messages' => [
|
|
'{"action":"ping"}',
|
|
'{"action":"subscribe","topics":["period.tick","period.opened"]}',
|
|
'{"action":"subscribe","topics":["bet.accepted","wallet.changed","auto.spin.progress"]}',
|
|
],
|
|
]);
|
|
}
|
|
}
|
|
|