定制 bazo/wamp-client 二次开发

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

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

bazo/wamp-client

Composer 安装命令:

composer require bazo/wamp-client

包简介

WAMP client in PHP

README 文档

README

About

This library has been tested with Ratchet WAMP server. It can only send messages to the server, listening for replies is not implemented. Supported functions:

  • prefix
  • call
  • publish
  • event

Based on https://github.com/Wisembly/elephant.io

Usage

$client = new \WAMP\WAMPClient('http://localhost:8080');
$sessionId = $client->connect();

//establish a prefix on server
$client->prefix("calc", "http://example.com/simple/calc#");

//you can send arbitrary number of arguments
$client->call('calc', 12,14,15);

$data = [0, 1, 2];

//or array
$client->call('calc', $data);

publish an event

//$payload can be scalar or array
$exclude = [$sessionId]; //no sense in sending the payload to ourselves
$eligible = [...] //list of other clients ids that are eligible to receive this payload
$client->publish('topic', $payload, $exclude, $eligible);

$client->event('topic', $payload);
$client->disconnect();

License

This software is distributed under MIT License. See LICENSE for more info.

Author

Martin Bažík martin@bazo.sk

Thanks

Thanks to Elephant.IO authors for the websocket communication part.

统计信息

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

GitHub 信息

  • Stars: 11
  • Watchers: 3
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-06-24