# ion-sfu **Repository Path**: rainfly123/ion-sfu ## Basic Information - **Project Name**: ion-sfu - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 1 - **Created**: 2021-07-02 - **Last Updated**: 2025-06-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README


Ion SFU

Go implementation of a WebRTC Selective Forwarding Unit

Slack Widget GoDoc Coverage Status Go Report Card License: MIT


A [selective forwarding unit](https://webrtcglossary.com/sfu/) is a video routing service which allows webrtc sessions to scale more efficiently. This package provides a simple, flexible, high performance Go implementation of a WebRTC SFU. It can be called directly or through a [gRPC](cmd/signal/grpc) or [json-rpc](cmd/signal/json-rpc) interface. ## Features * Audio/Video/Datachannel forwarding * Congestion Control (TWCC, REMB, RR/SR) * Unified plan semantics * Pub/Sub Peer Connection (`O(n)` port usage) * Audio level indication (RFC6464). "X is speaking" ## Quickstart Run the Echo Test example ``` docker-compose -f examples/echotest/docker-compose.yaml up ``` Open the client ``` http://localhost:8000/ ``` ### SFU with json-rpc signaling The json-rpc signaling service can be used to easily get up and running with the sfu. It can be used with the [corresponding javascript signaling module](https://github.com/pion/ion-sdk-js/blob/master/src/signal/ion-sfu.ts). ##### Using golang environment ``` go build ./cmd/signal/json-rpc/main.go && ./main -c config.toml ``` ##### Using docker ``` docker run -p 7000:7000 -p 5000-5200:5000-5200/udp pionwebrtc/ion-sfu:latest-jsonrpc ``` ### SFU with gRPC signaling For service-to-service communication, you can use the grpc interface. A common pattern is to call the grpc endpoints from a custom signaling service. ##### Using golang environment ``` go build ./cmd/signal/grpc/main.go && ./main -c config.toml ``` ##### Using docker ``` docker run -p 50051:50051 -p 5000-5200:5000-5200/udp pionwebrtc/ion-sfu:latest-grpc ``` ## Documentation Answers to some [Frequenty Asked Questions](FAQ.md). ## Examples To see some other ways of interacting with the ion-sfu instance, check out our [examples](examples). ## Media Processing `ion-sfu` supports real-time processing on media streamed through the sfu using [`ion-avp`](https://github.com/pion/ion-avp). For an example of recording a MediaStream to webm, checkout the [save-to-webm](https://github.com/pion/ion-avp/tree/master/examples/save-to-webm) example. ### License MIT License - see [LICENSE](LICENSE) for full text ## Development Generate the protocol buffers and grpc code: 1. Best choice (uses docker): `make protos`. 2. Manually: - Install protocol buffers and the protcol buffers compiler. On Fedora `dnf install protobuf protobuf-compiler`. - `go get google.golang.org/grpc/cmd/protoc-gen-go-grpc` - `go get google.golang.org/protobuf/cmd/protoc-gen-go` - `protoc --go_out=. --go-grpc_out=. --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative cmd/signal/grpc/proto/sfu.proto`