client

package
v0.0.0-...-ceb6196 Latest Latest
Warning

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

Go to latest
Published: May 11, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Initial          ConnectionState = 0
	WaitingForStream                 = 1
	Streamer                         = 2
	Viewer                           = 4
	Disconnected                     = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a middleman between the websocket connection and the hub.

func NewClient

func NewClient(hub *Hub, conn *SafeConnection) Client

func (*Client) ReadPump

func (c *Client) ReadPump()

func (*Client) WritePump

func (c *Client) WritePump()

writePump pumps messages from the hub to the websocket connection.

A goroutine running writePump is started for each connection. The application ensures that there is at most one writer to a connection by executing all writes from this goroutine.

type ConnectionState

type ConnectionState int32

type ErrorMessage

type ErrorMessage struct {
	Type        ErrorType
	Description string
}

type ErrorType

type ErrorType string
const (
	Unknown        ErrorType = "Unknown"
	InvalidMessage           = "Invalid Message"
)

type Hub

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

Hub maintains the set of active clients and broadcasts messages to the clients.

func NewHub

func NewHub() *Hub

func (*Hub) Run

func (h *Hub) Run()

type JoinRoomMessage

type JoinRoomMessage struct {
	RoomId string `json:"roomId"`
}

type MessageWrapper

type MessageWrapper struct {
	Type    messages.MessageType `json:"type"`
	Message json.RawMessage      `json:"message"`
}

type RoomInfo

type RoomInfo struct {
	VideoStream *webrtc.TrackLocalStaticRTP
	AudioStream *webrtc.TrackLocalStaticRTP
	// contains filtered or unexported fields
}

func (*RoomInfo) GetClientsInRoom

func (ri *RoomInfo) GetClientsInRoom() int

type RoomJoin

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

type RoomMessage

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

type SafeConnection

type SafeConnection struct {
	Mu   sync.Mutex
	Conn *websocket.Conn
}

type StartStreamInfoMessage

type StartStreamInfoMessage struct {
	StreamStartSuccess bool `json:"startStreamSuccess"`
}

type StreamerMessage

type StreamerMessage struct {
	RoomHasStreamer bool `json:"roomHasStreamer"`
}

type ViewerMessage

type ViewerMessage struct {
	Viewers uint32 `json:"viewers"`
}

Jump to

Keyboard shortcuts

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