承接 rx/thruway-client 相关项目开发

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

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

rx/thruway-client

Composer 安装命令:

composer require rx/thruway-client

包简介

RxPHP WAMP client

README 文档

README

This project is a WAMP v2 client written in PHP that uses RxPHP Observables instead of promises and event emitters.

If you don't know what WAMP is, you should read up on it.

If you don't know what RxPHP or ReactiveExtensions is, you're missing out...

Installation

composer require rx/thruway-client

Usage

use Rx\Observable;
use Rx\Thruway\Client;

require __DIR__ . '/vendor/autoload.php';

$wamp = new Client('ws://127.0.0.1:9090', 'realm1');

Call

$wamp->call('add.rpc', [1, 2])
    ->map(function (Thruway\Message\ResultMessage $r) {
        return $r->getArguments()[0];
    })
    ->subscribe(function ($r) {
        echo $r;
    });

Register

$wamp->register('add.rpc', function ($a, $b) { return $a + $b; })->subscribe();

If the Registration Handler throws an exception, thruway.error.invocation_exception is returned to the caller. If you would like to allow more specific error messages, you must throw a WampErrorException or, if using observable sequences that are returned from the RPC, you can onError a WampErrorException.

Publish to topic

$wamp->publish('example.topic', 'some value');
$wamp->publish('example.topic', Observable::interval(1000)); // you can also publish an observable

Subscribe to topic

$wamp->topic('example.topic')
    ->map(function(Thruway\Message\EventMessage $m) {
        return $m->getArguments()[0];
    })
    ->subscribe(function ($v) { echo $v; });

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 3
  • Forks: 4
  • 开发语言: PHP

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固