September 2018
Intermediate to advanced
398 pages
9h 43m
English
Each time a new connection is accepted (representing a new browser), we would like to keep a reference to that connection, so that events can be sent to it later. This connection container is handled by an Actor. This Actor will need an internal state with the list of connected browsers; we should add a new browser, and remove it once it is disconnected.
To create an Actor, we use the Props class from Akka, as follows:
val managerActor = actorSystem.actorOf( BrowserManagerActor.props(), "manager-actor")
This Actor is created from the guardian root Actor; in our case, it is named actorSystem. From the system Actor, the actorOf method is called; this method expects Props as the first parameter, representing our Actor ...
Read now
Unlock full access