Skip to content

Instantly share code, notes, and snippets.

@kanatohodets
Created October 8, 2015 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kanatohodets/21929bf2a05625d1d67c to your computer and use it in GitHub Desktop.
Save kanatohodets/21929bf2a05625d1d67c to your computer and use it in GitHub Desktop.
use v6;
sub handle-socket ($sock) {
$sock.print("thank you for subscribing to CAT FACTS\n");
while (1) {
sleep 1;
$sock.print("please hold while we fetch your cat fact...\n");
}
}
react {
whenever IO::Socket::Async.listen('localhost', 3005) -> $sock {
start {
handle-socket($sock);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment