gclient

package module
v0.0.0-...-6787493 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2025 License: MIT Imports: 17 Imported by: 1

README

Galene client library for Go

A library for writing clients for the Galene videoconferencing server. See the examples directory for usage samples.

— Juliusz Chroboczek

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Debug bool

Functions

func MakeId

func MakeId() string

MakeID returns a random string suitable for usage as an id.

Types

type AbortEvent

type AbortEvent struct {
	Id string
}

AbortEvent indicates that we have closed an up connection.

type ChatEvent

type ChatEvent struct {
	Kind, Id, Source, Username, Dest string
	Privileged                       bool
	Time                             string
	Value                            string
	History                          bool
}

ChatEvent indicates that we received a chat message.

type Client

type Client struct {
	EventCh chan any
	Id      string
	// contains filtered or unexported fields
}

Client represents a client-side connection.

func NewClient

func NewClient() *Client

NewClient creates a new client connection. Use *Client.Connect to actually connect to the server.

func (*Client) Abort

func (c *Client) Abort(id string)

Abort requests that the server close a down connection.

func (*Client) Chat

func (c *Client) Chat(kind, dest, value string) error

Chat sends a chat message to the server.

func (*Client) Close

func (c *Client) Close() error

Close gracefully closes a connection.

func (*Client) CloseUpConn

func (c *Client) CloseUpConn(id string) error

CloseUpConn closes a sending connection.

func (*Client) Connect

func (c *Client) Connect(ctx context.Context, group string) error

Connect connects to the server.

func (*Client) GetGroupStatus

func (c *Client) GetGroupStatus(ctx context.Context, group string) (*GroupStatus, error)

GetGroupStatus returns the status dictionary for a group. This might cache values for up to 60s.

func (*Client) GroupName

func (c *Client) GroupName() string

GroupName returns the name of the group that we have joined, or the empty string.

func (*Client) Join

func (c *Client) Join(ctx context.Context, group, username, password string) error

Join requests joining a group.

func (*Client) NewUpConn

func (c *Client) NewUpConn(id string, pc *webrtc.PeerConnection, label string) error

NewUpConn creates a new connection for sending data to the server.

func (*Client) RTCConfiguration

func (c *Client) RTCConfiguration() *webrtc.Configuration

RTCConfiguration returns the configuration suggested by the server.

func (*Client) Request

func (c *Client) Request(request map[string][]string) error

Request indicates which tracks the server should send.

func (*Client) SetAPI

func (c *Client) SetAPI(api *webrtc.API)

SetAPI sets the webrtc.API used for creating peer connections If this is not called, Pion's default API will be used.

func (*Client) SetDialer

func (c *Client) SetDialer(dialer *websocket.Dialer)

SetDialer sets the websocket.Dialer used for connecting to the server If this is not called, websocket.DefaultDialer will be used.

func (*Client) SetHTTPClient

func (c *Client) SetHTTPClient(hc *http.Client)

SetHTTPClient sets the http.Client used for HTTP requests If this is not called, http.DefaultClient will be used.

func (*Client) UserMessage

func (c *Client) UserMessage(dest string, kind string, value any) error

UserMessage sends a "usermessage" to the server.

func (*Client) Write

func (c *Client) Write(m *Message) error

Write writes a message to the server

type CloseEvent

type CloseEvent struct {
	Id string
}

CloseEvent indicates that the server has closed a down connection.

type DownConnEvent

type DownConnEvent struct {
	Id   string
	Conn *webrtc.PeerConnection
}

DownConnEvent indicates that we have received a new down connection.

type DownTrackEvent

type DownTrackEvent struct {
	Id       string
	Track    *webrtc.TrackRemote
	Receiver *webrtc.RTPReceiver
}

DownTrackEvent indicates that we have received a new down track.

type GroupStatus

type GroupStatus struct {
	Name              string `json:"name"`
	Redirect          string `json:"redirect,omitempty"`
	Location          string `json:"location,omitempty"`
	Endpoint          string `json:"endpoint,omitempty"`
	DisplayName       string `json:"displayName,omitempty"`
	Description       string `json:"description,omitempty"`
	AuthServer        string `json:"authServer,omitempty"`
	AuthPortal        string `json:"authPortal,omitempty"`
	Locked            bool   `json:"locked,omitempty"`
	ClientCount       *int   `json:"clientCount,omitempty"`
	CanChangePassword bool   `json:"canChangePassword,omitempty"`
}

GroupStatus is a group status, as returned by the server.

type JoinedEvent

type JoinedEvent struct {
	Kind     string
	Group    string
	Username string
	Value    string
}

JoinedEvent indicates that we either joined or left a group.

type Message

type Message struct {
	Type             string                   `json:"type"`
	Version          []string                 `json:"version,omitempty"`
	Kind             string                   `json:"kind,omitempty"`
	Error            string                   `json:"error,omitempty"`
	Id               string                   `json:"id,omitempty"`
	Replace          string                   `json:"replace,omitempty"`
	Source           string                   `json:"source,omitempty"`
	Dest             string                   `json:"dest,omitempty"`
	Username         *string                  `json:"username,omitempty"`
	Password         string                   `json:"password,omitempty"`
	Token            string                   `json:"token,omitempty"`
	Privileged       bool                     `json:"privileged,omitempty"`
	Permissions      []string                 `json:"permissions,omitempty"`
	Status           *GroupStatus             `json:"status,omitempty"`
	Data             map[string]interface{}   `json:"data,omitempty"`
	Group            string                   `json:"group,omitempty"`
	Value            interface{}              `json:"value,omitempty"`
	NoEcho           bool                     `json:"noecho,omitempty"`
	Time             string                   `json:"time,omitempty"`
	SDP              string                   `json:"sdp,omitempty"`
	Candidate        *webrtc.ICECandidateInit `json:"candidate,omitempty"`
	Label            string                   `json:"label,omitempty"`
	Request          interface{}              `json:"request,omitempty"`
	RTCConfiguration *webrtc.Configuration    `json:"rtcConfiguration,omitempty"`
}

Message is a message of Galene's protocol.

type UserEvent

type UserEvent struct {
	Kind     string
	Id       string
	Username string
}

UserEvent indicates that a user has joined or left the group.

type UserMessageEvent

type UserMessageEvent struct {
	Source string
	Kind   string
	Value  any
}

UserMessageEvent indicates that we have received a "usermessage".

Directories

Path Synopsis
examples
chat command
receive command
send command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL