.
function __construct(Emitter $emitter) { $this->emitter = $emitter; } public function onOpen(Connection $connection) { $this->connection = $connection; $this->emitter->emit("open"); } public function onMessage(Connection $connection, $message) { $this->emitter->emit("message", [$message]); } public