Implemented notify
This commit is contained in:
@ -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