Documentation
¶
Index ¶
- func DialSignaling(ctx context.Context, wsURL string, headers http.Header, dialer Dialer) (*websocket.Conn, error)
- func ReadSignaling(conn *websocket.Conn, route func(signaling.Message)) error
- func WriteSignaling(ctx context.Context, conn *websocket.Conn, message signaling.Message) error
- type Dialer
- type EventConnection
- type LiveNegotiation
- type SignalingWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DialSignaling ¶
func DialSignaling(ctx context.Context, wsURL string, headers http.Header, dialer Dialer) (*websocket.Conn, error)
DialSignaling opens a bounded signaling socket with an optional custom dialer.
func ReadSignaling ¶
ReadSignaling reads text frames until a transport or decoding error occurs.
Types ¶
type Dialer ¶
type Dialer interface {
DialContext(context.Context, string, http.Header) (*websocket.Conn, *http.Response, error)
}
Dialer allows tests and callers to substitute the signaling transport.
type EventConnection ¶
type EventConnection struct {
// contains filtered or unexported fields
}
EventConnection owns the transport, read loop, and event queue.
func OpenEvents ¶
func OpenEvents(ctx context.Context, wsURL, token, hardwareID string) (*EventConnection, error)
OpenEvents connects the account event stream and starts its read loop.
func (*EventConnection) Close ¶
func (ec *EventConnection) Close() error
Close closes the event connection
func (*EventConnection) Receive ¶
func (ec *EventConnection) Receive() (map[string]interface{}, error)
Receive receives an event from the connection
type LiveNegotiation ¶
type LiveNegotiation struct {
SignalID string
RIID string
AnswerSDP string
ControlID string
Heartbeat time.Duration
}
LiveNegotiation contains the identities and timing returned by signaling.
func AwaitLiveAnswer ¶
func AwaitLiveAnswer(ctx context.Context, parentDone <-chan struct{}, parentErr func() error, events <-chan signaling.Message, deviceID int64, deadlineError func() error) (LiveNegotiation, error)
AwaitLiveAnswer pairs session_created with the SDP answer and validates their identities.
type SignalingWriter ¶
type SignalingWriter struct {
// contains filtered or unexported fields
}
SignalingWriter bounds outgoing frames and prioritizes close, heartbeat, and PTZ stop.
func NewSignalingWriter ¶
func NewSignalingWriter(done <-chan struct{}, write func(context.Context, signaling.Message) error, onFailure func(error)) *SignalingWriter
NewSignalingWriter constructs a writer that stops when done closes.
func (*SignalingWriter) Finished ¶
func (w *SignalingWriter) Finished() <-chan struct{}
Finished closes after Run drains queued requests.
func (*SignalingWriter) Run ¶
func (w *SignalingWriter) Run()
Run services the writer queue until done closes.