Skip to content

Instantly share code, notes, and snippets.

@longcao longcao/Client.scala
Last active Dec 31, 2015

Embed
What would you like to do?
Client source code.
import akka.actor._
object Client extends App {
val system = ActorSystem("clientSystem")
val clientActor = system.actorOf(Props(new ClientActor), name = "ClientActor")
clientActor ! SayHello
}
class ClientActor extends Actor {
private val server = context.actorSelection("akka.tcp://serverSystem@127.0.0.1:2552/user/ServerActor")
def receive = {
case SayHello => server ! "Hello."
case message: String => println("Client received reply: " + message)
case _ => println("I got something I didn't understand.")
}
}
case object SayHello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.