Php Nginx推送流不工作
Nginx推送流不工作。来自/频道/一的空答案Php Nginx推送流不工作,php,nginx,Php,Nginx,Nginx推送流不工作。来自/频道/一的空答案 location ~ /pub { push_stream_publisher admin; push_stream_channels_path $arg_id; push_stream_store_messages on; allow 127.
location ~ /pub {
push_stream_publisher admin;
push_stream_channels_path $arg_id;
push_stream_store_messages on;
allow 127.0.0.1;
}
location ~ /channel/(.*) {
push_stream_subscriber long-polling ;
push_stream_channels_path $1;
push_stream_longpolling_connection_ttl 10s; push_stream_last_received_message_time $arg_time;
push_stream_last_received_message_tag $arg_tag;
push_stream_message_template "{\"id\":~id~,\"channel\":\"~channel~\",\"tag\":\"~tag~\",\"time\":\"~time~\",\"text\":~text~}";
}
PHP:
Javascript-
怎么办?请回答 如果这与HTTP/2有关,NGINX(v1.9.5)目前还不支持
推送流
$ch = curl_init('http://127.0.0.1/pub?id='.$channel_id);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($message));
curl_exec($ch);
curl_close($ch);