immusen 2018-10-17 16:57:57 2470次浏览 0条评论 0 0 0

基于Swoole 4的Yii2 MQTT扩展, 将遵循pathInfo的Topic解析到到controller/action/param, 类Yii2原生路由机制, 还是熟悉的配方, 还是原来味道! 同时支持Redis Pub/Sub 从Web应用递交异步任务.

yii2-swoole-mqtt

easy to use:
``
//MQTT subscribe topic: "channel/count/100001" will handle at:

class ChannelController{
    public function actionCount($channel_id){
            echo "client {$this->fd} subscribed the count change of channel {$channel_id}";
    }
}

//client 1 subscribed the count change of channel 100001
OR
//MQTT Publish Topic: "channel/join/100001" with payload: "Foo" will handle at:

class ChannelController{
    public function actionJoin($channel_id, $who){
            echo "{$who} join in channel {$channel_id}";
    }
}

// Foo join in channel 100001
``
原文链接: https://forum.yiiframework.com/t/mqtt-for-yii2-base-on-swoole-4/123369

    没有找到数据。
您需要登录后才可以评论。登录 | 立即注册