admsa / larachet
Laravel 5 and ratchet integration
dev-master
2015-03-10 09:33 UTC
Requires
- cboden/ratchet: 0.3.*
- guzzle/guzzle: ~3.9
- react/zmq: 0.3.*
Requires (Dev)
- phpspec/phpspec: ~2.1
This package is not auto-updated.
Last update: 2025-03-29 19:43:25 UTC
README
Laravel 5 and ratchet integration
Usage
Require composer
"admsa/larachet": "dev-master"
Add provider to your config/app.php
'providers' => [
// Existing providers
'Admsa\Larachet\LarachetServiceProvider',
]
Add facade alias to your config/app.php
'aliases' => [
// Existing aliases
'Larachet' => 'Admsa\Larachet\LarachetFacade'
]
$data = [];
Larachet::push('kittens-category', $data);
Javascript code usage
var r = new Larachet('ws://localhost:8080');
r.watch('kittens-category', function(topic, data) {
console.log('New article published to category "' + topic + '" : ' + JSON.stringify(data));
});
r.watch('puppy-category', function(topic, data) {
console.log('New article published to category "' + topic + '" : ' + JSON.stringify(data));
});
Note
This is still under development.
Javascript code is already loaded. Kindly check the html source code.
References
http://blog.alexandervn.nl/2012/05/03/install-zeromq-php-ubuntu