Go bindings for libquicr, a C++ implementation of Media over QUIC Transport (MoQT).
Supports MoQT draft-16.
go get github.com/quicr/qgo@latest
go generate github.com/quicr/qgoThis downloads platform-specific pre-built libraries from the latest release.
git clone --recursive https://github.com/quicr/qgo.git
cd qgo
make shimSee BUILD.md for detailed build instructions and requirements.
import "github.com/quicr/qgo"
func main() {
// Create and connect client
client, _ := qgo.NewClient(qgo.ClientConfig{
ConnectURI: "moq://localhost:4433",
EndpointID: "my-app",
})
defer client.Close()
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
client.Connect(ctx)
// Publish objects
pub, _ := client.PublishTrack(qgo.PublishTrackConfig{
FullTrackName: qgo.FullTrackName{
Namespace: qgo.ParseNamespace("app/channel"),
TrackName: qgo.NewTrackName("data"),
},
})
pub.PublishObject(qgo.ObjectHeaders{GroupID: 1, ObjectID: 1}, []byte("hello"))
// Subscribe to objects
sub, _ := client.SubscribeTrack(qgo.SubscribeTrackConfig{
FullTrackName: qgo.FullTrackName{
Namespace: qgo.ParseNamespace("app/channel"),
TrackName: qgo.NewTrackName("data"),
},
})
sub.OnObjectReceived(func(obj qgo.Object) {
fmt.Println("Received:", string(obj.Data))
})
}| Example | Description |
|---|---|
| clock | Simple publish/subscribe with timestamps |
| chat | Multi-user chat using SubNS flow |
# Build examples
make examples
# Run clock publisher
./bin/clock -mode publish -server localhost:4433
# Run chat
./bin/chat -server localhost:4433 -session myroom- BUILD.md - Building from source
- examples/ - Example applications with READMEs
- pkg.go.dev - API documentation
BSD-2-Clause. See LICENSE.