Skip to content

Quicr/quicr-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

qgo logo

qgo - Go Bindings for libquicr

CI

Go bindings for libquicr, a C++ implementation of Media over QUIC Transport (MoQT).

Supports MoQT draft-16.

Installation

Option 1: Using Pre-built Libraries (Recommended)

go get github.com/quicr/qgo@latest
go generate github.com/quicr/qgo

This downloads platform-specific pre-built libraries from the latest release.

Option 2: Building from Source

git clone --recursive https://github.com/quicr/qgo.git
cd qgo
make shim

See BUILD.md for detailed build instructions and requirements.

Quick Start

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))
    })
}

Examples

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

Documentation

License

BSD-2-Clause. See LICENSE.

About

CGO Wrapper around libquicr

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors