https://github.com/zircote/service_bayuex
A Zend Framework Bayuex Client
https://github.com/zircote/service_bayuex
Last synced: 11 months ago
JSON representation
A Zend Framework Bayuex Client
- Host: GitHub
- URL: https://github.com/zircote/service_bayuex
- Owner: zircote
- Created: 2011-07-28T23:20:39.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2011-07-29T14:55:45.000Z (almost 15 years ago)
- Last Synced: 2025-05-14T05:27:22.649Z (about 1 year ago)
- Language: PHP
- Homepage:
- Size: 97.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
### Publishing
```php
'http://127.0.0.1:8080/cometd'));
// Send Multiple messages
$payload = array(
array('channel' => '/chat/demo',
'data' => array ('user' => 'zircote','chat' => 'test1')
),
array('channel' => '/chat/demo',
'data' => array ('user' => 'zircote','chat' => 'test2')
),
array('channel' => '/chat/demo',
'data' => array ('user' => 'zircote','chat' => 'test3')
)
);
$b->publish($payload);
// Send Single Message
$b->publish('/chat/demo',array('user' => 'zircote', 'chat' => 'single message'));
```
### Subscribing and polling
```php
'http://127.0.0.1:8080/cometd'));
$b->subscribe(array('/chat/demo', '/some/test/'));
$o = 0;
while ($data = $b->connect('/chat/demo')){
$data = Zend_Json::decode($data, Zend_Json::TYPE_OBJECT);
foreach ($data as $m) {
if($m->data){
print_r( $m->data );
}
}
usleep(100);
if (++$o == 1000000) {
exit;;
}
}
```