conference

package
v0.0.0-...-c48bf83 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const PubSubHostString string = "pubsubserver.com"

Variables

This section is empty.

Functions

func ConvertTopicToConfURI

func ConvertTopicToConfURI(topic string) (confURI sip.Uri, err error)

Generate a Conference URI from a Topic string The ConfURI can be long and randomly generated, but in this implementation it is predictable for easy debug

func SearchForAUser

func SearchForAUser(user User, users []User) (i int, err error)

a User in a slice of Users return index of the found User and a nil-error return max int and an error otherwise.

Types

type ConfDescription

type ConfDescription struct {
	Subject string
}

Conference Description

type ConfInfo

type ConfInfo struct {
	ConfID  string
	ConfURI sip.Uri
	// Basic implementation from RFC4575
	ConfDescription
	ConfState
}

Conference Information

func NewConfInfo

func NewConfInfo(topic string) (newConfInfo ConfInfo)

Create a new Conference Information

func (*ConfInfo) String

func (ci *ConfInfo) String() (s string)

type ConfServer

type ConfServer struct {
	FactoryURI      sip.Uri
	TopicToConfInfo map[string]*ConfInfo
}

Conference Server Can be reached at its FactoryURI Maintains the slice of ConfInfo <-> Topics

func NewConfServer

func NewConfServer(fURI sip.Uri) (newConfServer *ConfServer)

Create a new Conference Server with an empty database of of TopicToConfInfo

func (*ConfServer) AddConfInfo

func (cs *ConfServer) AddConfInfo(confInfo ConfInfo) *ConfInfo

Create a new Conference Information for the corresponding Topic After that save that newly create ConfInfo to the slice of ConfInfo

func (*ConfServer) AddUserToTopic

func (cs *ConfServer) AddUserToTopic(topic string, user User) (err error)

Find a topic then add new user to that topic

func (*ConfServer) GetAllTopics

func (cs *ConfServer) GetAllTopics() (topics []string)

Return all topics handled by a Conference Server

func (*ConfServer) GetConfInfoByTopic

func (cs *ConfServer) GetConfInfoByTopic(topic string) (conf *ConfInfo, err error)

Retrieve a ConfInfo using Topic as a search key

func (*ConfServer) RemoveUserFromTopic

func (cs *ConfServer) RemoveUserFromTopic(topic string, user User) (err error)

TODO add RemoveUserFromTopic

func (*ConfServer) String

func (cs *ConfServer) String() (s string)

type ConfState

type ConfState struct {
	UserCount int
	Users     []User
}

Conference State

type User

type User struct {
	Entity string
	Role   string
}

User with a uri as its Entity and a role of either "Publisher" or "Subscriber"

Jump to

Keyboard shortcuts

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