POE::Component::Server::HTTP->new( Port => 8888, ContentHandler => { '/' => sub { my ($request, $response) = @_; $response->content(scalar read_file('index.html')); return RC_OK; }, '/stream' => sub { my ($request, $response) = @_; $clients{$response} = $response; $response->streaming(1); $response->code(RC_OK); return RC_OK; } }, StreamHandler => sub { my ($request, $response) = @_; if ( $response->is_error ) { delete $clients{$response}; $response->close; } }, );