broadcast-server

command module
v0.0.0-...-3de14b3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2022 License: MIT Imports: 18 Imported by: 0

README

broadcast

A simple Go server that broadcasts any data/stream. Read more about it on my blog. The code was written based of schollz/duct, which is a fork of of patchbay-pub.

Usage

Sending data

You can POST data.

curl -X POST --data-binary "@someimage.png" localhost:9222/test.png

The image will be available at localhost:9222/test.png.

Streaming audio

You can POST an audio stream to the server for any number of clients to consume it. For example, you can curl a local music stream and then POST it:

curl http://<someurl>/radio.mp3 | curl -k -H "Transfer-Encoding: chunked" -X POST -T -  'localhost:9222/test.mp3?stream=true'

This stream is now accessible at localhost:9222/test.mp3. The ?stream=true flag is important to tell the server to start reading bytes right awawy, even if there is no listener. It has the benefit of immediately sending data to all listeners so that you can have multiple connections on that will all receive the data. Another useful flags for streaming is advertise=true which will advertise the stream on the main page.

Installation

First install Go.

go install -v github.com/schollz/broadcast-server@latest

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL