client

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: AGPL-3.0, Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

View Source
const (
	WSConnectEvent       EventType = "WSConnect"
	WSDisconnectEvent              = "WSDisconnect"
	WSCallJoinEvent                = "WSCallJoin"
	WSCallRecordingState           = "WSCallRecordingState"
	WSCallJobState                 = "WSCallJobState"
	WSJobStopEvent                 = "WSStopJobEvent"
	RTCConnectEvent                = "RTCConnect"
	RTCDisconnectEvent             = "RTCDisconnect"
	RTCTrackEvent                  = "RTCTrack"
	CloseEvent                     = "Close"
	ErrorEvent                     = "Error"
)
View Source
const (
	TrackTypeVoice  = "voice"
	TrackTypeScreen = "screen"
)

Variables

This section is empty.

Functions

func ParseTrackID

func ParseTrackID(trackID string) (string, string, error)

ParseTrackID returns the track type and session ID for the given track ID.

Types

type CallJobState

type CallJobState struct {
	Type    string `json:"type"`
	InitAt  int64  `json:"init_at"`
	StartAt int64  `json:"start_at"`
	EndAt   int64  `json:"end_at"`
	Err     string `json:"err,omitempty"`
}

func (*CallJobState) FromMap

func (cjs *CallJobState) FromMap(m map[string]any)

type CallJoinMessage

type CallJoinMessage struct {
	ChannelID string `json:"channelID"`
	JobID     string `json:"jobID"`
}

type CallReconnectMessage

type CallReconnectMessage struct {
	ChannelID      string `json:"channelID"`
	OriginalConnID string `json:"originalConnID"`
	PrevConnID     string `json:"prevConnID"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a Golang implementation of a client for Mattermost Calls.

func New

func New(cfg Config, opts ...Option) (*Client, error)

New initializes and returns a new Calls client.

func (*Client) Close

func (c *Client) Close() error

Close permanently disconnects the client.

func (*Client) Connect

func (c *Client) Connect() error

Connect connects a call in the configured channel.

func (*Client) On

func (c *Client) On(eventType EventType, h EventHandler)

On is used to subscribe to any events fired by the client. Note: there can only be one subscriber per event type.

func (*Client) SendWS added in v0.14.0

func (c *Client) SendWS(ev string, msg any, binary bool) error

type Config

type Config struct {
	// SiteURL is the URL of the Mattermost installation to connect to.
	SiteURL string
	// AuthToken is a valid user session authentication token.
	AuthToken string
	// ChannelID is the id of the channel to start or join a call in.
	ChannelID string
	// JobID is an id used to identify bot initiated sessions (e.g.
	// recording/transcription)
	JobID string
	// contains filtered or unexported fields
}

func (*Config) Parse

func (c *Config) Parse() error

type EventHandler

type EventHandler func(ctx any) error

type EventType

type EventType string

type Option

type Option func(c *Client) error

Jump to

Keyboard shortcuts

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