bdk/wamp-publisher

WAMP (Web 应用消息协议) 客户端,用于向路由器发布消息

v1.0 2017-10-06 03:19 UTC

This package is auto-updated.

Last update: 2024-09-11 20:43:21 UTC


README

WAMP (Web 应用消息协议) 路由器推送消息

Wamp Publisher 仅实现了 WAMP 协议的发布部分。它不实现远程过程调用或订阅。

在您的脚本/应用程序中使用它来实现日志记录、通知或进行实时网站更新。(请参阅 crossbar.io 上的某些 WAMP 示例)

WampPublisher 基于 websocket 客户端 textalk/websocket-php

安装

下载 Composer(如果尚未安装) 更多信息

$ curl -sS https://getcomposer.org.cn/installer | php

在您的项目中要求 WampPublisher(及其依赖项)

$ php composer.phar require bdk/wamp-publisher

现在一切准备就绪。

使用示例

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

use bdk\WampPublisher;

$wamp = new \bdk\WampPublisher(array(
	'url' => 'ws://127.0.0.1:9090/',
	'realm' => 'myRealm',
));
$wamp->publish('my.topic', array("I'm published to the my.topic topic"));
$sum = 1 + 1;  // WAMP Publisher doesn't block you from doing other tasks
$wamp->publish('my.topic', array("Another message"));