You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Michael Murtaugh d0ac4bb95f added shebang python3 1 year ago proxy instructions 1 year ago
pipeserver.html pipeserver first implementation 1 year ago added shebang python3 1 year ago

Pipeserver is a simple webserver that uses websockets to distribute text received on stdin to connected webpages. By piping other processes into pipeserver, you can stream their messages and eventually produce customized javascript interfaces based on the content.

Installation of prerequisites:

pip3 install aiohttp aiohttp_jinja2


python3 pipeserver --template pipeserver.html

But of course the fun is to pipe into it…

liquidsoap -v my.liq | python3 pipeserver --template pipeserver.html

Server proxies


When behind an nginx proxy such as:

  # Appel du serveur local sur le port désormais alloué à apache
  proxy_set_header Host $host;

You will need to add to support websockets through the connection:

  # websocket stuff
  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "Upgrade";



a2enmod proxy
a2enmod proxy_http
a2enmod proxy_wstunnel
<VirtualHost *:80>

  RewriteEngine On
  RewriteCond %{REQUEST_URI}  ^/            [NC]
  RewriteCond %{QUERY_STRING} transport=websocket    [NC]
  RewriteRule /(.*)           ws://localhost:8080/$1 [P,L]

  ProxyPass / http://localhost:8080/
  ProxyPassReverse / http://localhost:8080/

<VirtualHost *:443>
  RewriteEngine on
  RewriteCond ${HTTP:Upgrade} websocket [NC]
  RewriteCond ${HTTP:Connection} upgrade [NC]
  RewriteRule .* "wss:/localhost:3000/$1" [P,L]
  ProxyPass / https://localhost:3000/
  ProxyPassReverse / https://localhost:3000/
  ProxyRequests off