Documentation ¶
Index ¶
- Constants
- func GetICEServerConfigs() []sfu.ICEServerConfig
- func Signal(sfuSignal *SfuSignal, targetPeerId string) (interface{}, error)
- type PoolEvent
- type SfuPeer
- func (this *SfuPeer) Connected() bool
- func (this *SfuPeer) EmitEvent(name string, event *PoolEvent) (interface{}, error)
- func (this *SfuPeer) GetPeer() *p2p.NetPeer
- func (this *SfuPeer) Id() string
- func (this *SfuPeer) RegistEvent(name string, fn func(event *PoolEvent) (interface{}, error)) bool
- func (this *SfuPeer) SetPeer(connectPeerId string, connectSessionId string, peerType string)
- func (this *SfuPeer) UnregistEvent(name string) bool
- type SfuPeerPool
- func (this *SfuPeerPool) EmitEvent(name string, event *PoolEvent) (interface{}, error)
- func (this *SfuPeerPool) GetPeer(netPeer *p2p.NetPeer) *SfuPeer
- func (this *SfuPeerPool) Receive(netPeer *p2p.NetPeer, payload map[string]interface{}) (interface{}, error)
- func (this *SfuPeerPool) RegistEvent(name string, fn func(event *PoolEvent) (interface{}, error))
- func (this *SfuPeerPool) Remove(netPeer *p2p.NetPeer) error
- func (this *SfuPeerPool) UnregistEvent(name string) bool
- type SfuSignal
Constants ¶
View Source
const ( SfuSignalType_Join = "join" SfuSignalType_Offer = "offer" SfuSignalType_Answer = "answer" SfuSignalType_Trickle = "trickle" )
Variables ¶
This section is empty.
Functions ¶
func GetICEServerConfigs ¶
func GetICEServerConfigs() []sfu.ICEServerConfig
Types ¶
type SfuPeer ¶
* 代表两个peer之间的webrtc连接
func NewSfuPeer ¶
func (*SfuPeer) RegistEvent ¶
func (*SfuPeer) UnregistEvent ¶
type SfuPeerPool ¶
* 代表SFU服务器,包含多个peer与peer之间的webrtc连接 每个SFU服务器有多个session,每个session表示一个房间,内含多个peer,在一个session内的peer互相订阅
func GetSfuPeerPool ¶
func GetSfuPeerPool() *SfuPeerPool
func NewSfuPeerPool ¶
func NewSfuPeerPool() *SfuPeerPool
func (*SfuPeerPool) EmitEvent ¶
func (this *SfuPeerPool) EmitEvent(name string, event *PoolEvent) (interface{}, error)
* 触发sfu的全局事件
func (*SfuPeerPool) Receive ¶
func (this *SfuPeerPool) Receive(netPeer *p2p.NetPeer, payload map[string]interface{}) (interface{}, error)
* 收到客户端发来的消息进行分派处理
func (*SfuPeerPool) RegistEvent ¶
func (this *SfuPeerPool) RegistEvent(name string, fn func(event *PoolEvent) (interface{}, error))
* 注册sfu的全局事件
func (*SfuPeerPool) UnregistEvent ¶
func (this *SfuPeerPool) UnregistEvent(name string) bool
type SfuSignal ¶
type SfuSignal struct { //四种类型 SignalType string `json:"type,omitempty"` // 房间号 Sid string `json:"sid,omitempty"` // 房间的原始节点 PrimaryPeerId string `json:"sid,omitempty"` // join,offer,answer Sdp *webrtc.SessionDescription `json:"sdp,omitempty"` // candidate(trickle) publisher:0 or subscriber:1 Target int `json:"target,omitempty"` // candidate(trickle) Candidate *webrtc.ICECandidateInit `json:"candidate,omitempty"` }
Click to show internal directories.
Click to hide internal directories.