Hi Alex,
Thanks for these directions. I will try them out!
Best,
Eric
Le 22/11/2019 à 16:31, Alexander Burger a écrit :
Hi Eric,
Is there any way to have a web app watch a
file and update itself (as well as what is
displayed by the browser) as soon as the file
is changed?
Yes, I think the necessary ingredients are there.
For example, I use inotifywait to watch database replication files (in the fifo/
directory) and when they change start 'ssl' to replicate them to a remote
server. In startup scripts I have:
if test -z $(pgrep -u app -x inotifywait)
then
echo inotifywait
inotifywait -mq -e modify --format '%f' --exclude beat fifo |
while read F
do
if test -z $(pgrep -u app -f "bin/ssl .* $F.r")
then
bin/ssl remoteHost.de 443 $F.r/\!replica key/remoteHost fifo/$F
db/$F/blob/ 20 20
fi
done &
fi
Instead of calling bin/ssl, you would start a script which connects to your
application locally and triggers an 'allow'ed function.
That function then could use Server Sent Events
https://picolisp.com/wiki/?ServerSentEvents
to update things on the user's screen.
☺/ A!ex
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe