mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-12-05 07:12:34 -05:00
switch to websocket for live stream (#59)
The multipart stream / hanging GET approach worked in a prototype for a single stream, but Chrome has a per-host limit of six connections. If I try streaming all my cameras at once, I hit that limit. I can't open all the streams, much less additional connections to load init segments and such. Websockets apparently has a much higher limit of 256.
This commit is contained in:
@@ -198,6 +198,11 @@ upstream moonfire {
|
||||
server 127.0.0.1:8080;
|
||||
}
|
||||
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default Upgrade;
|
||||
'' close;
|
||||
}
|
||||
|
||||
server {
|
||||
root /var/www/html;
|
||||
index index.html index.htm index.nginx-debian.html;
|
||||
@@ -209,6 +214,10 @@ server {
|
||||
# try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header Host $http_host;
|
||||
@@ -256,5 +265,9 @@ Login with the credentials you added through `moonfire-nvr config` in the
|
||||
[previous guide](install.md). You should see your username and "logout" in the
|
||||
upper-right corner of the web interface.
|
||||
|
||||
Also try the live streaming feature, which requires WebSockets. The nginx
|
||||
configuration above includes sections derived from nginx's [NGINX as a
|
||||
WebSocket Proxy](https://www.nginx.com/blog/websocket-nginx/) doc.
|
||||
|
||||
If it doesn't work as expected, re-read this guide, then open an issue on
|
||||
github for help.
|
||||
|
||||
Reference in New Issue
Block a user