Implemented notify
This commit is contained in:
1 parent
f849ac481a
commit
6f49b69a66
4 files changed
+60
-4
No files matched your search
@@ -109,6 +109,16 @@ class CommandBus implements CommandBusInterface
|
||||
*/
|
||||
public function notify(string $event, array $data): void
|
||||
{
|
||||
$this->emit(self::EVENT_NOTIFY, [ $event, $data ]);
|
||||
|
||||
$json = (new Message(Message::MSGTYPE_NOTIFY, [
|
||||
'event' => $event,
|
||||
'data' => $data
|
||||
]))->toJson();
|
||||
|
||||
foreach ($this->connections as $client) {
|
||||
$client->write($json."\n");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user