tomeshnet / ipfs-live-streaming

Like HTTP live streaming, but with IPFS which is maybe better?
GNU General Public License v3.0
449 stars 74 forks source link

Use pubsub to distribute a changing file #31

Open benhylau opened 6 years ago

benhylau commented 6 years ago

The file we want to distribute is the changing live.m3u8 because IPNS isn't reliable, and ipfs pubsub pub <topic> <data> seems to work well.

First we need to enable --enable-pubsub-experiment in the /etc/systemd/system/ipfs.service for all the ipfs nodes. Then on server:

ipfs add live/current.m3u8 | awk '{print $2","}' | ipfs pubsub pub m3u8

On mirrors, run:

ipfs pubsub sub m3u8 > m3u8-sub.log

and in a crontab:

ipfs cat `awk -F, '{ print $(NF-1) }' m3u8-sub.log` > live.m3u8

We decided not to use this for Our Networks since:

darkdrgn2k commented 6 years ago

Might be interesting to look at https://cluster.ipfs.io/