Skip to content

Instantly share code, notes, and snippets.

@soc
Created October 21, 2011 02:16
Show Gist options
  • Save soc/1302952 to your computer and use it in GitHub Desktop.
Save soc/1302952 to your computer and use it in GitHub Desktop.
val myActor = Actor.actorOf(new ChatPeer(localName, localIp)).start()
var abort = false
while (!abort) {
val input = Console.readLine("Send message (or type `:log` for the log): ")
if (input.trim() == ":log")
myActor ! Message(localName, System.currentTimeMillis(), input)
else
(myActor ? GetChatLog).as[ArrayBuffer[Message]].foreach(println)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment