1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace app\common\util;
- use Channel\Client;
- use Exception;
- use think\facade\Log;
- class Channel
- {
- public function __construct(){
- }
-
- public function sendChannel(string $events, string $type, int $connection_ids=0, array $data = []){
- try {
- Client::connect(config('channel.ip'),config('channel.port'));
- }catch (Exception $e) {
-
- Log::write( $e->getMessage(),'notice');
- }
- Client::publish($events,[
- 'type'=>$type,
- 'data'=>$data,
- 'connection_ids'=>$connection_ids,
- ]);
- }
- }
|