Skip to content

Separate domain model from MessageSender/Reader #3

@jacobkiers

Description

@jacobkiers

Currently it is pretty hard to test the code completely.

As the handlers have many dependencies, their construction is difficult.

In order to make stuff simpler we should make the domain model observable. The observer(s) should receive events and send it to the socket.

On the other side, no reading is done by the domain model, all messages are received via the onMessage() function.

An example:

<?php
$handler = new ClientHandler();
$observer = new ArrayStoreObserver($handler);
$handler->onMessage(new ClientRequestMessage());
print_r($observer->shiftMessage());

This should print an OK message.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions