server

package
v0.0.0-...-8567bd0 Latest Latest
Warning

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

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

Documentation

Overview

Package server implements a basic webrtc server layer

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Shutdown

func Shutdown(server *Server)

Shutdown ... NOTE(hugo): we cannot close the unregisterCh because it's shared with peers, we would need to wait for peers to be unnregistered first

Types

type Config

type Config struct {
	Log                     *logging.Logger
	WebRtc                  IWebRtc
	EstablishSessionTimeout time.Duration
	ICEServers              []ICEServer
	ExitOnCoordinatorClose  bool
	MaxPeers                uint16
	WebRtcLogLevel          zerolog.Level

	OnNewPeerHdlr          func(p *Peer) error
	OnPeerDisconnectedHdlr func(p *Peer)
}

Config represents the server config

type DataChannel

type DataChannel = pion.DataChannel

DataChannel is the top level pion's data channel

type DataChannelState

type DataChannelState = pion.DataChannelState

DataChannelState is the pion's data channel state

type ICECandidate

type ICECandidate = pion.ICECandidate

ICECandidate is the pion's ICECandidate

type ICECandidateType

type ICECandidateType = pion.ICECandidateType

ICECandidateType is the pion's ICECandidateType

type ICEConnectionState

type ICEConnectionState = pion.ICEConnectionState

ICEConnectionState is the pion's ICEConnectionState

type ICEServer

type ICEServer = pion.ICEServer

ICEServer represents a ICEServer config

type IWebRtc

type IWebRtc interface {
	// contains filtered or unexported methods
}

IWebRtc is this module interface

type Peer

type Peer struct {
	Alias uint64

	Conn *PeerConnection

	Log logging.Logger
	// contains filtered or unexported fields
}

Peer represents a server connection

func (*Peer) Close

func (p *Peer) Close()

Close ...

func (*Peer) IsClosed

func (p *Peer) IsClosed() bool

IsClosed is the underline webrtc connection is closed

type PeerConnection

type PeerConnection = pion.PeerConnection

PeerConnection represents the webrtc connection

type PeerStats

type PeerStats struct {
	pion.StatsReport
	Alias uint64
}

PeerStats ...

func (*PeerStats) Get

func (ps *PeerStats) Get(id string) (pion.Stats, bool)

Get get stats by stats ID

type ReadWriteCloser

type ReadWriteCloser = datachannel.ReadWriteCloser

ReadWriteCloser is the detached datachannel pion's interface for read/write

type Server

type Server struct {
	Alias uint64
	// contains filtered or unexported fields
}

Server ...

func NewServer

func NewServer(config *Config) (*Server, error)

NewServer creates a new communication server

func (*Server) ConnectCoordinator

func (s *Server) ConnectCoordinator(url string) (*protocol.WelcomeMessage, error)

ConnectCoordinator establish a connection with the coordinator

func (*Server) ConnectPeer

func (s *Server) ConnectPeer(alias uint64) error

ConnectPeer initiates the peer connection, it will send a connect message thought the coordinator and create the peer itself

func (*Server) GetServerStats

func (s *Server) GetServerStats() Stats

GetServerStats ...

func (*Server) ProcessControlMessages

func (s *Server) ProcessControlMessages()

ProcessControlMessages starts the control message processor

type Stats

type Stats struct {
	Time                time.Time
	Alias               uint64
	ConnectChSize       int
	WebRtcControlChSize int
	UnregisterChSize    int
	Peers               []PeerStats
}

Stats ...

Jump to

Keyboard shortcuts

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