This repository was archived by the owner on Sep 20, 2021. It is now read-only.
This repository was archived by the owner on Sep 20, 2021. It is now read-only.
Creating topics for classified of broadcasting message... #52
Closed
Description
Creating topics for classified of broadcasting message
Hello again.
Other things is about the creation of topics, of thread for sending message at one or more groups of recipients, for example, create some tags, example, notify.admins
, chat.public
, chat.private.{thread_id}
, etc, and opened this threads from the javascript client, and validate this connect using php. For example:
use HoaTopic;
...
public function getLogin()
{
HoaTopic::send('Login rendered', 'notify.admin');
return view('auth.login');
}
...
and in the class HoaWebSocket
, or other, do this.
class HoaTopic extend HoaWebSocket {
...
public function send($message, $topic) {
$user = Sentinel::getUser();
if ($topic == 'notify.admin') {
if (!$user->hasAccess('admin')) {
self::send('Access Denied at user '.$user->id, 'notify.admin');
return;
}
$nodes = $bucket->getSource()->getTopics($topic)->getConnection()->getNodes();
foreach ($nodes as $node) {
$node->send($message);
}
}
}
...
}
Thanks
YnievesDotNet