addServer($server); $bus->on(CommandBus::EVENT_NOTIFY, function (string $event, array $data) { printf("notify event: %s %s\n", $event, json_encode($data, JSON_UNESCAPED_SLASHES)); } ); $client = new CommandBusClient(); $client->connect("tcp://127.0.0.1:9999"); $client->on(CommandBusClient::EVENT_NOTIFY, function (string $event, array $data) { printf("notify client: %s %s\n", $event, json_encode($data, JSON_UNESCAPED_SLASHES)); } ); // Wait for connections etc, before sending a notification. Loop::addTimer(1, function () use ($bus) { $bus->notify("hello", [ 'greet'=>"World" ]); }); // Shutdown in 2 secs Loop::addTimer(2, function () use ($bus, $client) { $bus->close(); $client->close(); });