定制 shakahl/socket.io-php-emitter 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

shakahl/socket.io-php-emitter

最新稳定版本:0.1.1

Composer 安装命令:

composer require shakahl/socket.io-php-emitter

包简介

PHP socket.io event emitter

README 文档

README

A PHP implementation of node.js socket.io-emitter (0.1.0).

Installation

composer require shakahl/socket.io-php-emitter

Usage

Emit payload message

use Predis;
use Shakahl\SocketIO;
...

$client = new Predis\Client();

(new Emitter($client))
    ->of('namespace')->emit('event', 'payload message');

Flags

Possible flags

  • json
  • volatile
  • broadcast

To use flags, just call it like in examples bellow

use Predis;
use Shakahl\SocketIO;
...

$client = new Predis\Client();

(new Emitter($client))
    ->broadcast->emit('broadcast-event', 'payload message');

(new Emitter($client))
    ->flag('broadcast')->emit('broadcast-event', 'payload message');

Emit an object

use Predis;
use Shakahl\SocketIO;
...

$client = new Predis\Client();

(new Emitter($client))
    ->emit('broadcast-event', ['param1' => 'value1', 'param2' => 'value2', ]);

Emit an object in a rooms

use Predis;
use Shakahl\SocketIO;
...

$client = new Predis\Client();

(new Emitter($client))
    ->in(['room1', 'room2'])
    ->emit('broadcast-event', ['param1' => 'value1', 'param2' => 'value2', ]);

Credits

This library is forked from exls/socket.io-emitter created by Anton Pavlov.

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 10
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-11-08