protoo

package module
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: MIT Imports: 11 Imported by: 0

README

Protoo

Minimalist and extensible golang signaling framework for multi-party Real-Time applications.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewEventEmitter = eventemitter.NewEventEmitter
View Source
var NewLogger = func(name string) logr.Logger {
	return zerologr.New(&zl).WithName(name)
}

Functions

This section is empty.

Types

type Error

type Error struct {
	ErrorCode   int    `json:"errorCode,omitempty"`
	ErrorReason string `json:"errorReason,omitempty"`
}

func NewError

func NewError(code int, reason string) *Error

func (Error) Error

func (e Error) Error() string

type IEventEmitter

type IEventEmitter = eventemitter.IEventEmitter

type Message

type Message struct {
	OK           bool            `json:"ok,omitempty"`
	Request      bool            `json:"request,omitempty"`
	Response     bool            `json:"response,omitempty"`
	Notification bool            `json:"notification,omitempty"`
	Id           uint32          `json:"id,omitempty"`
	Method       string          `json:"method,omitempty"`
	Data         json.RawMessage `json:"data,omitempty"`

	*Error
}

func CreateErrorResponse

func CreateErrorResponse(request Message, err *Error) Message

func CreateNotification

func CreateNotification(method string, data interface{}) Message

func CreateRequest

func CreateRequest(method string, data interface{}) Message

func CreateSuccessResponse

func CreateSuccessResponse(request Message, data interface{}) Message

func (Message) Marshal

func (m Message) Marshal() []byte

func (Message) String

func (m Message) String() string

type Peer

type Peer struct {
	IEventEmitter
	// contains filtered or unexported fields
}

func NewPeer

func NewPeer(peerId string, data interface{}, transport Transport) *Peer

func (*Peer) Close

func (peer *Peer) Close()

func (*Peer) Data

func (peer *Peer) Data() interface{}

func (*Peer) Id

func (peer *Peer) Id() string

func (*Peer) Notify

func (peer *Peer) Notify(method string, data interface{}) error

func (*Peer) Request

func (peer *Peer) Request(method string, data interface{}) (rsp PeerResponse)

type PeerResponse

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

func (PeerResponse) Data

func (r PeerResponse) Data() []byte

func (PeerResponse) Err

func (r PeerResponse) Err() error

func (PeerResponse) Unmarshal

func (r PeerResponse) Unmarshal(v interface{}) error

type Room

type Room struct {
	IEventEmitter
	// contains filtered or unexported fields
}

func NewRoom

func NewRoom() *Room

func (*Room) Close

func (r *Room) Close()

func (*Room) Closed

func (r *Room) Closed() bool

func (*Room) CreatePeer

func (r *Room) CreatePeer(peerId string, peerData interface{}, transport Transport) (peer *Peer, err error)

func (*Room) GetPeer

func (r *Room) GetPeer(peerId string) *Peer

func (*Room) HasPeer

func (r *Room) HasPeer(peerId string) bool

func (*Room) Peers

func (r *Room) Peers() (peers []*Peer)

type Transport

type Transport interface {
	eventemitter.IEventEmitter
	fmt.Stringer
	Send(data []byte) error
	Close()
	Closed() bool
	Run() error
}

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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