Notifies the listeners of an event. Won't stop until the event has been handled by a listener.

@param Event $event
@param callback $callback Will be called once the event has been processed
@return bool
961493
public function notifyUntil(Event $event, $callback = null)
    {
        if ($this->notify($event)) {
            if ($callback) {
                $callback();
            }
            return true;
        }
        $this->stackedEvents[] = array($event, $callback);
        return false;
    }
990707
public function listen($callback) {
		if ($this->listening) {
			$this->connection->read(function ($line) use ($callback) {
				$this->checkForError($line);
				$change = $this->parseChangeLine($line);
				if ($change) {
					return $callback($change);
				}
			});
		}
	}
849760
public function notifyUntil($eventName, array $params = array(), $callback = null)
    {
        $this->dispatcher->notifyUntil($e = $this->createEvent($eventName, $params), $callback);
        return $e;
    }
148861
public function on(string $event, $callback)
    {
        if (! is_string($callback) && ! is_callable($callback)) {
            throw new InvalidArgumentException(
                'Invalid websocket callback. Must be a string or callable.'
            );
        }

        $this->callbacks[$event] = $callback;

        return $this;
    }
1129905
protected function callListener($callable, Event $event)
    {
        if ($callable instanceof Closure || is_array($callable)) {
            call_user_func_array($callable, array_filter([$event, $event->getSubject(), $event->getData()]));
        } elseif (is_object($callable)) {
            $callable->{$event->getType()}($event, $event->getSubject(), $event->getData());
        }
    }
1355559
public function on($event, $callback) {
		if (!is_callable($callback)) {
			throw new ListenException(var_export($callback, true) . " is not callback");
		}
		$this->callback[$event] = $callback;
	}
1005003
public function attempting($callback)
    {
        if (isset($this->events)) {
            $this->events->listen(Events\Attempting::class, $callback);
        }
    }
291870
protected function trigger($event)
    {
        $class = static::class;

        if ($this->withEvent && isset(self::$event[$class][$event])) {
            foreach (self::$event[$class][$event] as $callback) {
                $result = call_user_func_array($callback, [$this]);

                if (false === $result) {
                    return false;
                }
            }
        }

        return true;
    }
1038989
protected function callListeners($event, $args = [])
    {
        if (!$this->hasListeners($event)) {
            return false;
        }

        foreach ($this->listeners[$event] as $listener) {
            $this->callListener($listener, is_array($args) ? $args : [$args]);
        }

        return true;
    }
21371
public function on($event, $callback)
        {
            if (!is_callable($callback)) {
                throw new Exception('Socketio::on() type callback must be callable.');
            }

            if (!isset($this->callbacks[$event])) {
                $this->callbacks[$event] = array();
            }

            // @TODO Handle case where callback is a string
            if (in_array($callback, $this->callbacks[$event])) {
                $this->stdout('debug', 'Skip existing callback');
                return;
            }

            $this->callbacks[$event][] = $callback;
        }
593724
public function on(string $eventName, callable $callBack, int $priority = 100)
    {
        // If it ends with a wildcard, we use the wildcardListeners array
        if ('*' === $eventName[\strlen($eventName) - 1]) {
            $eventName = \substr($eventName, 0, -1);
            $listeners = &$this->wildcardListeners;
        } else {
            $listeners = &$this->listeners;
        }

        // Always fully reset the listener index. This is fairly sane for most
        // applications, because there's a clear "event registering" and "event
        // emitting" phase, but can be slow if there's a lot adding and removing
        // of listeners during emitting of events.
        $this->listenerIndex = [];

        if (!isset($listeners[$eventName])) {
            $listeners[$eventName] = [];
        }
        $listeners[$eventName][] = [$priority, $callBack];
    }
695120
private function isCallbackBlacklisted($callback, $listener)
    {
        return ((ContainerOnLoadCallbackListener::class === $listener)
                && \is_array($callback)
                && ('checkPermission' === $callback[1])
                && (0 === strpos($callback[0], 'tl_')));
    }
331301
protected function addEventListener($name, $callback)
    {
        if (Str::contains($name, '*')) {
            $callback = function ($name, array $data) use ($callback) {
                return $callback($data[0]);
            };
        }

        $this->events->listen($name, $callback);
    }
601024
public function removeListener($event, $callback)
    {
        if (false === isset($this->listeners[$event])) {

            return;
        }

        $key = array_search($callback, $this->listeners[$event]);
        if ($key !== false) {
            unset($this->listeners[$event][$key]);

            if (0 === count($this->listeners[$event])) {
                unset($this->listeners[$event]);
            }
        }
    }
566258
public function on($type, $name, $callback)
    {
        $name = $type . '.' . $name;
        if (!isset($this->events[$name])) {
            $this->events[] = [];
        }

        $this->events[$name][] = $callback;
    }
123184
public function attach($event, $callback) {
        $events = is_array($event) ? $event : array($event);
        $listeners = $this->getOption(self::OPTION_LISTENERS);
        foreach ($events as $event) {
            $eventObject = is_object($event) ? $event : new GenericEvent($event);
            if (!isset($listeners[$eventObject->getName()])) {
                $listeners[$eventObject->getName()] = array();
            }

            if (!in_array($callback, $listeners[$eventObject->getName()], true)) {
                $listeners[$eventObject->getName()][] = $callback;
            }
        }
        $this->setOption(self::OPTION_LISTENERS, $listeners);
    }
117963
public function on ($event, callable $callback)
	{
		if (!isset ($this->events[$event]))
		{
			$this->events[$event] = array ();
		}
		$this->events[$event][] = $callback;
	}