/** * Notify handlers about given event * * @param RequestDescriptor $requestDescriptor Request descriptor * @param Event $event Event object * * @return void * @throws StopSocketOperationException */ public function callSocketSubscribers(RequestDescriptor $requestDescriptor, Event $event) { $requestDescriptor->invokeEvent($event); foreach ($this->handlers as $handler) { $handler->invokeEvent($event); } if ($event->isOperationCancelled()) { throw new StopSocketOperationException(); } }