Skip to content

[PHP Worker] listen to all PHP instances events via worker.addEventListener() - #2673

Merged
adamziel merged 7 commits into
trunkfrom
listen-to-all-php-events-separate
Sep 23, 2025
Merged

adamziel merged 7 commits into
trunkfrom
listen-to-all-php-events-separate

Conversation

@adamziel

Copy link
Copy Markdown
Collaborator

Before this PR, worker.addEventListener() only listens to the events emitted by the primary PHP instance. After this PR, it listens to events emitted by all the PHP instances created by a given worker.

Implementation details

Instead of passing through the worker.addEventListener() call to the primary PHP instance, the PHPWorker class:

  • Registers a wildcard event listener for all PHP events.
  • Maintains its own list of event listeners.

Whenever any PHP instance emits an event that has worker-wide listeners registered, the worker class notifies them.

This PR refactors all the worker implementations: web and node, v1 and v2.

Testing instructions

CI (TODO: Add test coverage)

…stener()

Before this PR, worker.addEventListener() only listens to the events
emitted by the primary PHP instance. After this PR, it listens to events
emitted by all the PHP instances created by a given worker.

 ## Implementation details

Instead of passing through the `worker.addEventListener()` call to the
primary PHP instance, the PHPWorker class:

* Registers a wildcard event listener for all PHP events.
* Maintains its own list of event listeners.

Whenever any PHP instance emits an event that has worker-wide listeners
registered, the worker class notifies them.

This PR refactors all the worker implementations: web and node, v1 and
v2.

 ## Testing instructions

CI (TODO: Add test coverage)
@adamziel
adamziel merged commit a972497 into trunk Sep 23, 2025
27 checks passed
@adamziel
adamziel deleted the listen-to-all-php-events-separate branch September 23, 2025 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant