Signal handling interfaces and participant specific HTTP PATCH. (#3804)
* HTTP PATCH on participant sid * rename * signal handler * new files * clean up * clean up reassembly * handle messages on server side * deps * staticcheck * clean up
This commit is contained in:
@@ -107,6 +107,8 @@ func (s rtcRestService) Create(ctx context.Context, req *rpc.RTCRestCreateReques
|
||||
}, nil
|
||||
}
|
||||
|
||||
// -------------------------------------------
|
||||
|
||||
type rtcRestParticipantService struct {
|
||||
*RoomManager
|
||||
}
|
||||
@@ -187,3 +189,40 @@ func (r rtcRestParticipantService) DeleteSession(ctx context.Context, req *rpc.R
|
||||
|
||||
return &emptypb.Empty{}, nil
|
||||
}
|
||||
|
||||
// --------------------------------
|
||||
|
||||
type signalv2ParticipantService struct {
|
||||
*RoomManager
|
||||
}
|
||||
|
||||
func (s signalv2ParticipantService) RelaySignalv2Participant(ctx context.Context, req *rpc.RelaySignalv2ParticipantRequest) (*rpc.RelaySignalv2ParticipantResponse, error) {
|
||||
room := s.RoomManager.GetRoom(ctx, livekit.RoomName(req.Room))
|
||||
if room == nil {
|
||||
return nil, ErrRoomNotFound
|
||||
}
|
||||
|
||||
lp := room.GetParticipantByID(livekit.ParticipantID(req.ParticipantId))
|
||||
if lp == nil {
|
||||
return nil, ErrParticipantNotFound
|
||||
}
|
||||
|
||||
err := lp.HandleSignalRequest(req.WireMessage)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var wireMessage *livekit.Signalv2WireMessage
|
||||
pending := lp.SignalPendingMessages()
|
||||
if pending != nil {
|
||||
var ok bool
|
||||
wireMessage, ok = pending.(*livekit.Signalv2WireMessage)
|
||||
if !ok {
|
||||
return nil, ErrInvalidMessageType
|
||||
}
|
||||
}
|
||||
|
||||
return &rpc.RelaySignalv2ParticipantResponse{
|
||||
WireMessage: wireMessage,
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user