mediaserver

package
v0.0.0-...-4d27765 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CMD_StartSession = "StartSession"
	CMD_ReceiveChunk = "ReceiveChunk"
	CMD_EndSession   = "EndSession"
)

Client commands

View Source
const (
	CMD_MonitorSession = "MonitorSession"
	CMD_JoinSession    = "JoinSession" // Join to an existing user session

)

Admin commands

View Source
const (
	SESSION_STARTED    = "STARTED"
	SESSION_INPROGRESS = "INPROGRESS"
	SESSION_ENDED      = "ENDED"
)
View Source
const AdminConnType = 1
View Source
const CMD_Auth = "Auth"
View Source
const (
	CMD_ReceiveSessionId = "ReceiveSessionId"
)

Server commands

View Source
const CMD_Telemetry = "Telemetry"

Naming convention in the package. When a action is required we prefix it with CMD (Command) When a data or information is passed we prefix variable as MSG(Message) Telemetry command to send some telemetry data

View Source
const UserConnType = 0

Variables

View Source
var AUDIO_PREFIX = "audio-data"
View Source
var BUCKET_NAME string
View Source
var PROFILE = "dev"
View Source
var SessionStore = map[string]*Session{}
func init() {
	redidClient = redis.NewClient(&redis.Options{
		Addr:     PROPERTIES.MustGet("openavstream.redis.connection"),
		Password: "", // no password set
		DB:       0,  // use default DB
	})
}
View Source
var VIDEO_PREFIX = "video-data"

Functions

func GetProperty

func GetProperty(key string) string

func IsSessionExist

func IsSessionExist(sessionId string) bool

Types

type ClientLogData

type ClientLogData struct {
}

type ClientMetricsData

type ClientMetricsData struct {
}

type ClientMsg

type ClientMsg struct {
	Command   string
	SessionId string
	AuthToken string
	Data      string
}

type Connection

type Connection struct {
	Id         string
	ClientAddr string
	Conn       *websocket.Conn
}

Holds the socket connection and a unique id for it.

type ConnectionGroup

type ConnectionGroup struct {
	UserConnection  Connection
	AdminConnection []Connection
}

Holds a group of connection. Group is defined by one user connection and multiple Admin connection.

type ServerMsg

type ServerMsg struct {
	Command   string
	Data      string
	SessionId string
}

type Session

type Session struct {
	SessionId string
	AuthToken string
	ConnGroup ConnectionGroup
	State     string
}

Session is started when first user connects to it the server a unique session Id is given to it.

func CreateNewSession

func CreateNewSession(conn *websocket.Conn) *Session

Creates a new session

func (*Session) WriteBinary

func (s *Session) WriteBinary(data []byte, connType int)

write the binary data to the socket

func (*Session) WriteText

func (s *Session) WriteText(data []byte, connType int)

Write the text data to the socket

type StartConversationData

type StartConversationData struct {
	Name    string
	Type    string
	Version string
}

type TelemetryData

type TelemetryData struct {
	Type string
	Data string
}

Jump to

Keyboard shortcuts

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