Skip to content

Instantly share code, notes, and snippets.

@akgupta
Created September 18, 2016 19:00
Show Gist options
  • Save akgupta/d078801dd2d7fd975428223f7b20cccd to your computer and use it in GitHub Desktop.
Save akgupta/d078801dd2d7fd975428223f7b20cccd to your computer and use it in GitHub Desktop.
Client Connection Actor forwards a message on the EventSource connection
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