bootphpized / wamp-client
PHP 的 WAMP 客户端
dev-master
2017-08-02 17:45 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2024-09-25 02:41:40 UTC
README
关于
此库已在 Ratchet WAMP 服务器上进行了测试。它只能向服务器发送消息,尚未实现监听回复。支持的功能
- prefix
- call
- publish
- event
基于 https://github.com/Wisembly/elephant.io
用法
$client = new \WAMP\WAMPClient('https://: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();
许可证
此软件根据 MIT 许可证分发。有关更多信息,请参阅 LICENSE。
作者
Martin Bažík martin@bazo.sk
感谢
感谢 Elephant.IO 作者提供的 WebSocket 通信部分。