Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/schollz/broadcast-server
A simple Go server that broadcasts any data/stream.
https://github.com/schollz/broadcast-server
internet-radio radio radio-station streaming-audio
Last synced: 3 months ago
JSON representation
A simple Go server that broadcasts any data/stream.
- Host: GitHub
- URL: https://github.com/schollz/broadcast-server
- Owner: schollz
- License: mit
- Created: 2022-01-06T15:34:18.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-03-17T04:26:06.000Z (over 2 years ago)
- Last Synced: 2024-07-08T21:06:00.707Z (4 months ago)
- Topics: internet-radio, radio, radio-station, streaming-audio
- Language: Go
- Homepage: https://schollz.com/blog/radio
- Size: 519 KB
- Stars: 68
- Watchers: 5
- Forks: 15
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# broadcast
A simple Go server that broadcasts any data/stream. Read more about it [on my blog](https://schollz.com/blog/radio/). The code was written based of [schollz/duct](https://github.com/schollz/duct), which is a fork of of [patchbay-pub](https://github.com/patchbay-pub/patchbay-simple-server).
## 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:///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