Playing with Actor Room
In the previous section, we have seen a number of projects that are using Enumerators
/Iteratees
to send and receive messages reactively, with various levels of complexity. Iteratees
are powerful, but using them can sometimes lead to code snippets that are not easy to understand. The Play Actor Room project, which is available at https://github.com/mandubian/play-actor-room, proposes to reduce some of the complexity of setting up Iteratees
by abstracting away this part and letting the programmer focus only on the domain logic, such as processing incoming messages and assembling outgoing messages. This project started from the observation that many applications need the same functionality, which can be seen as a server Room
(holding state, for instance, and being the middle man between distributed clients). The role of this room is to listen for incoming messages from connected clients, and either broadcast received messages after processing them or just unicast communication...