protected function boot(ContainerInterface $container)
{
$runtime = $container->make('Kraken\\Runtime\\RuntimeContainerInterface');
$channel = $container->make('Kraken\\Runtime\\Service\\ChannelInternal');
$console = $container->make('Kraken\\Runtime\\Service\\ChannelConsole');
$loop = $container->make('Kraken\\Loop\\LoopInterface');
if ($runtime->getParent() === null) {
$this->applyRootRouting($runtime, $channel, $console);
} else {
$this->applySimpleRouting($runtime, $channel);
}
$runtime->on('create', function () use($channel) {
$channel->start();
});
$runtime->on('destroy', function () use($loop, $channel) {
$loop->onTick(function () use($channel) {
$channel->stop();
});
});
}