Documentation
¶
Overview ¶
Package rtcbridge multiplexes one LiveKit RoomCallback into bounded, context-first subscriptions. It is dependency-neutral so the worker can install it while constructing a Room, before higher-level RoomIO exists.
Index ¶
Constants ¶
const DefaultRTCEventCapacity = 256
Variables ¶
var ( ErrRTCBridgeClosed = errors.New("roomio: RTC bridge is closed") ErrRTCEventOverflow = errors.New("roomio: RTC event queue overflow") )
Functions ¶
This section is empty.
Types ¶
type CallbackPanicError ¶
CallbackPanicError reports a panic recovered at an application callback boundary. A user callback can therefore not take down an RTC or RoomIO lifecycle goroutine.
func (*CallbackPanicError) Error ¶
func (e *CallbackPanicError) Error() string
type RTCBridge ¶
type RTCBridge struct {
// contains filtered or unexported fields
}
RTCBridge multiplexes one RoomCallback into bounded RoomIO subscriptions. The callback returned by Callback must be installed when the room is created; server-sdk-go v2.18.1 does not expose post-construction callback registration.
func NewRTCBridge ¶
func NewRTCBridge(base *lksdk.RoomCallback, options RTCBridgeOptions) *RTCBridge
NewRTCBridge composes base callbacks with a nonblocking bounded event bridge. base may be nil. Existing callback behavior is preserved, with panics isolated and reported through OnCallbackPanic.
func NewRoom ¶
func NewRoom(base *lksdk.RoomCallback, options RTCBridgeOptions) (*lksdk.Room, *RTCBridge)
NewRoom creates a server-SDK Room with the bridge callback installed. RoomIO never disconnects this room; the caller retains room and E2EE ownership.
func (*RTCBridge) Callback ¶
func (b *RTCBridge) Callback() *lksdk.RoomCallback
func (*RTCBridge) SubscribeTypes ¶
func (b *RTCBridge) SubscribeTypes(capacity int, events ...RTCEventType) (*RTCSubscription, error)
SubscribeTypes limits a subscription to the listed event types. Internal media actors use this to avoid allocating and dispatching high-volume data or transcription events they do not consume. With no event types it is equivalent to Subscribe.
type RTCBridgeOptions ¶
type RTCBridgeOptions struct {
// EventCapacity is the default capacity of each subscription. A subscriber
// that cannot keep up is failed visibly with ErrRTCEventOverflow; RTC
// callbacks are never blocked and lifecycle events are never silently lost.
EventCapacity int
OnCallbackPanic func(error)
}
type RTCEvent ¶
type RTCEvent struct {
Type RTCEventType
Participant *lksdk.RemoteParticipant
ChangedAttributes map[string]string
Track *webrtc.TrackRemote
Publication *lksdk.RemoteTrackPublication
LocalPublication *lksdk.LocalTrackPublication
DisconnectReason livekit.DisconnectReason
DataPacket lksdk.DataPacket
DataReceiveParams lksdk.DataReceiveParams
TranscriptionSegments []*lksdk.TranscriptionSegment
TranscribedParticipant lksdk.Participant
TranscribedPublication lksdk.TrackPublication
}
RTCEvent contains only SDK-owned handles whose public methods are safe to call after the callback returns. TranscriptionSegments and data payloads are defensively copied by the bridge.
type RTCEventType ¶
type RTCEventType string
RTCEventType is the lossless control-event vocabulary emitted by RTCBridge.
const ( RTCEventParticipantConnected RTCEventType = "participant_connected" RTCEventParticipantDisconnected RTCEventType = "participant_disconnected" RTCEventParticipantAttributesChanged RTCEventType = "participant_attributes_changed" RTCEventTrackPublished RTCEventType = "track_published" RTCEventTrackUnpublished RTCEventType = "track_unpublished" RTCEventTrackSubscribed RTCEventType = "track_subscribed" RTCEventTrackUnsubscribed RTCEventType = "track_unsubscribed" RTCEventLocalTrackPublished RTCEventType = "local_track_published" RTCEventLocalTrackUnpublished RTCEventType = "local_track_unpublished" RTCEventLocalTrackSubscribed RTCEventType = "local_track_subscribed" RTCEventReconnecting RTCEventType = "reconnecting" RTCEventReconnected RTCEventType = "reconnected" RTCEventDisconnected RTCEventType = "disconnected" RTCEventDataPacket RTCEventType = "data_packet" RTCEventTranscription RTCEventType = "transcription" )
type RTCSubscription ¶
type RTCSubscription struct {
// contains filtered or unexported fields
}
RTCSubscription is a single-consumer, explicitly closable event stream.
func (*RTCSubscription) Close ¶
func (s *RTCSubscription) Close() error