Skip to content

Instantly share code, notes, and snippets.

@jonathanstowe
Last active April 16, 2016 13:03
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jonathanstowe/cf9178dc8d27d5e2542e1137f7137427 to your computer and use it in GitHub Desktop.
use HTTP::Server::Tiny;
my $s = supply {
whenever Supply.interval(1) {
emit("data: { DateTime.now }\r\n\r\n".encode);
}
}
sub app(%env) {
return 200, [ Cache-Control => 'must-revalidate, no-cache',Content-Type => 'text/plain; charset=utf-8, text/event-stream' ], $s;
}
HTTP::Server::Tiny.new(port => 7787,max-keepalive-reqs => 10).run(&app);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment