Constructor
public __construct ( array $options, React\EventLoop\LoopInterface $loop = null ) | ||
$options | array | |
$loop | React\EventLoop\LoopInterface |
function __construct() { $this->options = \Drupal::config('thruway.settings')->get('options'); $loop = \Drupal::service('thruway.loop'); parent::__construct($this->options, $loop, new ConsoleLogger()); $this->pluginManager = \Drupal::service('thruway.plugin.manager'); $this->serializer = \Drupal::service('serializer'); $this->annotationReader = new AnnotationReader(); $this->resources = \Drupal::config('thruway.settings')->get('resources'); //Register the Thruway annotation AnnotationRegistry::registerFile(\Drupal::service('module_handler')->getModuleList()['thruway']->getPath() . "/src/Annotation/Thruway.php"); $this->on('open', [$this, 'onSessionStart']); $this->on('close', function ($reason) { $this->getClient()->getLogger()->alert("Connection closing because: {$reason}"); }); // $this->getClient()->setLogger(\Drupal::logger("thruway")); $this->getClient()->setLogger(new ConsoleLogger()); }