A RTP -> WebRTC broadcast server for Project Lightspeed.



Project Lightspeed WebRTC

Stars Badge Forks Badge Pull Requests Badge Issues Badge GitHub contributors License Badge

A RTP -> WebRTC server based on Pion written in Go. This server accepts RTP packets on port 65535 and broadcasts them via WebRTC

View Demo · Report Bug · Request Feature

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgements

About The Project

This is one of three components required for Project Lightspeed. Project Lightspeed is a fully self contained live streaming server. With this you will be able to deploy your own sub-second latency live streaming platform. This particular repository takes RTP packets sent to the server and broadcasts them over WebRTC. In order for this to work the Project Lightspeed Ingest server is required to perfrom the FTL handshake with OBS. In order to view the live stream the Project Lightspeed viewer is required.

Built With

  • Pion
  • Golang


Getting Started

To get a local copy up and running follow these simple steps.


In order to run this Golang is required. Installation instructions can be found here


Using go get

export GO111MODULE=on
go get github.com/GRVYDEV/lightspeed-webrtc

Using git

git clone https://github.com/GRVYDEV/Lightspeed-webrtc.git
cd Lightspeed-webrtc
go build


To run type the following command.

Using go get

lightspeed-webrtc --addr=XXX.XXX.XXX.XXX

Using git

cd Lightspeed-webrtc
go build
./lightspeed-webrtc --addr=XXX.XXX.XXX.XXX


Argument Supported Values Defaults Notes
--addr A valid IP address localhost This is the local Ip address of your machine. It defaults to localhost but should be set to your local IP. For example This is where the server will listen for UDP packets and where it will host the websocket endpoint for SDP negotiation
--ip A valid IP address none Sets the public IP address for WebRTC to use. This is especially useful in the context of Docker
--ports A valid UDP port range 20000-20500 This sets the UDP ports that WebRTC will use to connect with the client
--ws-port A valid port number 8080 This is the port on which the websocket will be hosted. If you change this value make sure that is reflected in the URL used by the react client
--rtp-port A valid port number 65535 This is the port on which the WebRTC service will listen for RTP packets. Ensure this is the same port that Lightspeed Ingest is negotiating with the client


See the open issues for a list of proposed features (and known issues).


Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request


Distributed under the MIT License. See LICENSE for more information.


Garrett Graves - @grvydev

Project Link: https://github.com/GRVYDEV/Lightspeed-webrtc


  • Websocket unable to connect

    Websocket unable to connect

    Error from browser in console xxx is public IP address of server: App.js:21 WebSocket connection to 'ws://xxx:8080/websocket' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

    Socket encountered error: undefined Closing socket

    Command run on server xxx is private IP address of server: ./lightspeed-webrtc --addr=xxx

    opened by torchsmith 13
  • wss:// support

    wss:// support

    On https:// server browsers block insecure ws:// connections by default as mixed content. Changing url's protocol in react app to wss:// results in failed WebSocket connection with Error in connection establishment: net::ERR_SSL_PROTOCOL_ERROR. I was able to work around this by changing url in react app to wss://MYHOSTNAME/websocket and setting up reverse proxy in nginx config like this:

    server {
            listen 443 ssl http2;
            server_name MYHOSTNAME;
            location /websocket {
                    proxy_set_header Host $host;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                    proxy_http_version 1.1;
                    proxy_set_header Upgrade $http_upgrade;
                    proxy_set_header Connection "upgrade";
                    proxy_read_timeout 86400s;

    Now if lightspeed-webrtc runs without arguments (on localhost) browser doesn't log any errors. It would be more convenient if wss:// was directly supported by lightspeed without the need of reverse proxy.

    opened by r4rdsn 4
  • ICE Failure

    ICE Failure

    Hello, what a fantastic project. Thank you!

    I'm having trouble setting up the demo, and it looks like it's down to the WebRTC connection, possibly in ICE resolution.

    Lightspeed-ingest is running on 8084. Lightspeed-webrtc is using 8080 and udp 65535, with --addr=192.168.1.xxx (my LAN IP address) Lightspeed-react is serving on 8082 and has set "ws://example.com:8080/websocket" in wsUrl.js (with my domain in place of example). Firewall has opened TCP 8080, 8082, and 8084. My environment is Windows 10. I'm running everything on the same local machine for now.

    OBS is streaming, connected via domain name. Lightspeed-ingest shows:

    Listening on port 8084 Hashes match! Client connected! Protocol Version: 0.9 Vendor Name: OBS Studio Vendor Version: 26.1.0 Video Codec: H264 Video Height: 720 Video Width: 1280 Audio Codec: OPUS

    When the webpage loads, the websocket connects successfully. Lightspeed-webrtc shows:

    Waiting for RTP Packets Connections: 1

    The video does not load, and simply shows the poster. The JavaScript log shows:

    Connected to websocket offer candidate candidate candidate candidate Candidate fail

    Based on App.js, it looks like "Candidate fail" is an ICE failure. Is there some additional network configuration needed?

    opened by woodrowbarlow 4
  • Feature websocket hub

    Feature websocket hub

    Move the websocket connection handling in a separate package and use a hub structure to prepare for chat functionality. Communication with the hub is done via channels to avoid manual locking/unlocking. This also addresses issue #7 and includes some general cleanups.

    opened by tcriess 3
  • Statically link binary and remove dependency on debian:buster-slim

    Statically link binary and remove dependency on debian:buster-slim

    Corresponding to https://github.com/GRVYDEV/Lightspeed-ingest/pull/35 statically linking the binary and removing the dependency on buster-slim makes the image smaller.

    opened by geneccx 3
  • Socket periodically closes

    Socket periodically closes

    Each ~50-60 seconds socket closes and immediately reconnects, causing stream to lag for several seconds before reloading the player. Console output:

    App.js:36 Socket is closed. Reconnect will be attempted in 0.5 second. 
    App.js:26 Connected to websocket

    lightspeed-webrtc output:

    websocket: close 1006 (abnormal closure): unexpected EOF
    Connections: 1
    opened by r4rdsn 3
  • If using default hostadresse it fails as you manually add port 8080 to it

    If using default hostadresse it fails as you manually add port 8080 to it

    If you give no argument so it uses the default, then it will use:

    addr         = flag.String("addr", "localhost:8080", "http service address")

    Which causes this error:

    ➜ docker run --rm -it --name webrtc-test webrtc-test
    Waiting for RTP Packets
    listen tcp: address localhost:8080:8080: too many colons in address

    I assume the error is caused when it tries to use it in L86:

    log.Fatal(http.ListenAndServe(*addr+":8080", nil))

    (https://github.com/GRVYDEV/Lightspeed-webrtc/blob/main/main.go#L86) And you manually add 8080 to it.

    Probably enough just to remove :8080 from the default argument in L25

    opened by Crowdedlight 3
  • Add support for WSS:// with arguments.

    Add support for WSS:// with arguments.

    Adds args for --ssl-cert and --ssl-key. If both are specified, this will use ListenAndServeTLS instead of ListenAndServe. Tested and works, when combined with Lightspeed-react using wss:// in config.json as well as the same ssl cert and ssl key.

    opened by Stovoy 2
  • Simpler and more efficient cleanConnections

    Simpler and more efficient cleanConnections

    I was glancing through the code and was interested by this function.

    I think it can be simplified in this way -- even if the connection is blocking on a Remove/AddTrack at the instant, the peer connection still signaled it closed so I think it'd be appropriate to boot it out of the list instantly? Which as far I as I see is only used for telemetry at the moment. (A prometheus counter might actually be what you want 🙂 )

    Also, I noticed you were using order-preserving delete, which required reallocating, or at least copying, the entire list if you removed the first element. But you don't need to preserve order, so you can do a simple cheap swap instead.

    opened by connor4312 2
  • Allow passing port range and IP address for ICE connections

    Allow passing port range and IP address for ICE connections

    At the moment, if you run lightspeed-webrtc within a docker container, it will try to announce a candidate of a completely random port, and a local 172.x.x.x IP address (basically, the IP within the container). This causes the stream to never reach the browser.

    As for the port ranges, Pion appears to pick any port randomly. By passing a port range, we can also pass the same (restricted) port range to Docker or docker-compose and successfully pass the ICE connections through.

    In the same way that the websocket addr can be given via --addr, a public-facing IP address and a set of ports should be set through something like --ip and --ports.

    opened by k3d3 1
  • Debug connection issues

    Debug connection issues

    There are some random issues with the connection process. Sometimes the connection just wont work, other times it takes forever and sometimes it works perfectly.

    opened by GRVYDEV 1
  • help: webrtc does not work when I connect from another network

    help: webrtc does not work when I connect from another network

    streaming via webrtc does not work when I connect from another network.

    I have all 3 components running in a VM, I also configured and opened the respective ports to see the transmission from another host on the local network, and it works fine.

    The problem is when I send the transmission to the internet, configure my router and open the necessary ports, also the portforwarding, but I still don't receive the streaming, only the web works but the video player does not load.

    opened by xabru 8
Garrett GRVY Graves
I am a Full Stack developer that loves creating software. Anything from embedded systems to web applications, if it involves coding I love it.
Garrett GRVY Graves
a simple http server as replacement of python -m http.server

ser a simple http server as replacement of python -m http.server

Changkun Ou 4 Dec 5, 2022
OpenAPI specs for your Go server, generated at server runtime. No CLI, no code generation, and no HTTP

Overview "oas" is short for "OpenAPI Spec". Go package for generating OpenAPI docs at runtime. Non-features: No code generation. No CLI. No magic comm

Nelo Mitranim 0 Dec 3, 2021
A Language Server Protocol (LSP) server for Jsonnet

Jsonnet Language Server A Language Server Protocol (LSP) server for Jsonnet. Features Jump to definition self-support.mp4 dollar-support.mp4 Error/War

Grafana Labs 92 Dec 14, 2022
Go web server - A web server that can accept a GET request and serve a response.

go_web_server A web server that can accept a GET request and serve a response. Go is a great language for creating simple yet efficient web servers an

Gilbert Ngeno 0 Jan 3, 2022
:tophat: Small self-contained pure-Go web server with Lua, Markdown, HTTP/2, QUIC, Redis and PostgreSQL support

Web server with built-in support for QUIC, HTTP/2, Lua, Markdown, Pongo2, HyperApp, Amber, Sass(SCSS), GCSS, JSX, BoltDB (built-in, stores the databas

Alexander F. Rødseth 2.2k Jan 1, 2023
Fast, multi-platform web server with automatic HTTPS

a project Every site on HTTPS Caddy is an extensible server platform that uses TLS by default. Releases · Documentation · Get Help Menu Features Insta

Caddy 45.1k Jan 1, 2023
A simple SHOUTcast server.

DudelDu DudelDu is a simple audio/video streaming server using the SHOUTcast protocol. Features Supports various streaming clients: VLC, ServeStream,

Matthias Ladkau 138 Nov 20, 2022
A feature flag solution, with only a YAML file in the backend (S3, GitHub, HTTP, local file ...), no server to install, just add a file in a central system and refer to it. 🎛️

??️ go-feature-flag A feature flag solution, with YAML file in the backend (S3, GitHub, HTTP, local file ...). No server to install, just add a file i

Thomas Poignant 565 Dec 29, 2022
An XMPP server written in Go (Golang).

jackal An XMPP server written in Go. About jackal is a free, open-source, high performance XMPP server which aims to be known for its stability, simpl

Miguel Ángel Ortuño 1.4k Dec 29, 2022
A proxy server than converts JSON request bodies to protocol buffers

Welcome to Protoxy ?? What is Protoxy? Protoxy allows you to test your REST APIs that use Protocol Buffer serialization through Postman and other API

null 28 Nov 1, 2022
High-performance PHP application server, load-balancer and process manager written in Golang

[RR2-BETA] RoadRunner is an open-source (MIT licensed) high-performance PHP application server, load balancer, and process manager. It supports runnin

Spiral Scout 6.9k Jan 4, 2023
Fully featured and highly configurable SFTP server with optional FTP/S and WebDAV support - S3, Google Cloud Storage, Azure Blob

SFTPGo Fully featured and highly configurable SFTP server with optional FTP/S and WebDAV support, written in Go. Several storage backends are supporte

Nicola Murino 5.4k Jan 9, 2023
Heart 💜A high performance Lua web server with a simple, powerful API

Heart ?? A high performance Lua web server with a simple, powerful API. See the full documentation here. Overview Heart combines Go's fasthttp with Lu

Hyperspace Logistics 77 Aug 31, 2022
The Galène videoconferencing server

The Galène videoconferencing server

Juliusz Chroboczek 714 Dec 28, 2022
A push notification server written in Go (Golang).

A push notification micro server using Gin framework written in Go (Golang)

Bo-Yi Wu 6.7k Jan 9, 2023
KissLists is a very simple shared lists server

KissLists is a very simple shared lists server. with mobile optimised design basic theme support websockets messages sqlite database but no

Vincent Lark 39 Nov 30, 2022
⚡ A fast, lightweight, and secure chat protocol, client and server, written in Go.

⚡ A fast, lightweight, and secure chat protocol, client and server, written in Go.

Bolt 17 Oct 27, 2022
A simple HTTP Server to share files over WiFi via Qr Code

go-fileserver A simple HTTP server to share files over WiFi via QRCode Installation You can download compressed version from

Pradeep Khileri 71 Oct 8, 2022