Created
September 18, 2016 19:00
-
-
Save akgupta/d078801dd2d7fd975428223f7b20cccd to your computer and use it in GitHub Desktop.
Client Connection Actor forwards a message on the EventSource connection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ClientConnectionActor extends UntypedActor { | |
public static Props props(String connectionId, EventSource eventSource) { | |
return Props.create(ClientConnectionActor.class, () -> new ClientConnectionActor(connectionId, eventSource)); | |
} | |
public void onReceive(Object msg) throws Exception { | |
if (msg instanceof ClientMessage) { | |
eventSource.send(event(Json.toJson(clientMessage))); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment