Pusher 服务 Sdk
To install the SDK in your project you need to require the package via composer:
composer require larva/pusher-sdk您可以创建这样的SDK实例:
$forge = new Larva\Pusher\Forge('http://ws.domain.com', TOKEN_HERE);发布点对点事件:
$res = $forge->publish('6557749ee6d95#32131','event', ['name'=>'张三']);向频道广播事件:
$res = $forge->trigger('room1','event', ['name'=>'张三']);
//或者
$channel = $forge->channel('room1');
$channel->trigger('event', ['name'=>'张三']);查询频道在线人数:
$channel = $forge->channel('room1');
$channel->online_users;Larva Forge SDK is open-sourced software licensed under the MIT license.