承接 kismia/centrifugo-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kismia/centrifugo-bundle

Composer 安装命令:

composer require kismia/centrifugo-bundle

包简介

A Centrifugo bundle for Symfony

README 文档

README

This is wrapper for PHP client for Centrifugo real-time messaging server.

Installation

Install the latest version with

composer require kismia/centrifugo-bundle

Register bundle in app\AppKernel.php

    public function registerBundles()
    {
        $bundles = [
            .......
            new \Kismia\CentrifugoBundle\CentrifugoBundle()
        ];
    }

Configure centrifugo-bundle. In the config file add the following lines

centrifugo:
    apiendpoint: 'http//example.com/api/'
    secret: 'secret api key'
    transport:
        redis:
            host: 'localhost'
            shards: 6
            db: 2
            timeout: 0.3
            port: 6379
        http: []

Basic usage

<?php
    $userId = 1;
    $channel = '#chan_1';
    $messageData = ['message' => 'Hello, world!'];
    
    //instance of Centrifugo client class
    $centrifugo = $this->get('centrifugo.client');
    
    //Send message into channel.
    $response = $centrifugo->publish($channel, $messageData);
            
    //Very similar to publish but allows to send the same data into many channels.
    $response = $centrifugo->broadcast($channels, $messageData);        
            
    //Unsubscribe user from channel.
    $response = $centrifugo->unsubscribe($channel, $userId);
            
    //Disconnect user by user ID.
    $response = $centrifugo->disconnect($userId);
            
    //Get channel presence information (all clients currently subscribed on this channel).
    $response = $centrifugo->presence($channel);
            
    //Get channel history information (list of last messages sent into channel).
    $response = $centrifugo->history($channel);
            
    //Get channels information (list of currently active channels).
    $response = $centrifugo->channels();
            
    //Get stats information about running server nodes.
    $response = $centrifugo->stats();
            
    //Get information about single Centrifugo node.
    $response = $centrifugo->node('http://node1.example.com/api/');    

统计信息

  • 总下载量: 22.36k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 11
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 11
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-03-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固