Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何从Dancer路由保持HTTP连接_Html_Perl_Http_Dancer - Fatal编程技术网

Html 如何从Dancer路由保持HTTP连接

Html 如何从Dancer路由保持HTTP连接,html,perl,http,dancer,Html,Perl,Http,Dancer,我在一个项目中使用Perl Dancer,我想实现SSEs 我有一条舞者路线,我正努力保持它的活力 get '/stream' => sub{ my $response = Dancer::SharedData->response; debug($response->exists); $response->status(200); $response->content("data: cool test\n\n"); $resp

我在一个项目中使用Perl Dancer,我想实现SSEs

我有一条舞者路线,我正努力保持它的活力

get '/stream' => sub{
    my $response = Dancer::SharedData->response;
    debug($response->exists);
    $response->status(200);
    $response->content("data: cool test\n\n");
    $response->content_type( 'text/event-stream' );
    $response->header( 'Cache-Control' => 'no-cache' );
    $response->header( 'Connection' => 'Keep-Alive' );
    $response->pass;
    return undef;
};
似乎从舞者路线返回任何东西都会关闭连接。理想情况下,我希望它保持打开状态并存储
$response
,以便将更多数据推送到以后

更新:在进一步的研究中,舞者使用的PSGI似乎可以做到这一点:
此时正在研究中间件方法。

这里的答案是转移到另一个Web服务器。我使用的是不支持http连接的starman。移动到mojolicous或twiggy