Update: Combined Endpoints to do correct jobs.
This commit is contained in:
@@ -6,30 +6,23 @@ namespace RelayServer.Endpoints;
|
||||
public static class RtcEndpoints
|
||||
{
|
||||
/// <summary>
|
||||
/// Maps all RTC-related HTTP endpoints used for joining calls, storing offers and answers,
|
||||
/// writing ICE candidates, and leaving active calls.
|
||||
/// Maps all RTC-related HTTP endpoints used for storing offers and answers,
|
||||
/// writing ICE candidates, checking active calls, and leaving active calls.
|
||||
/// </summary>
|
||||
/// <param name="app">The web application to map endpoints onto.</param>
|
||||
public static void MapRtcEndpoints(this WebApplication app)
|
||||
{
|
||||
// Join a channel call and determine whether the caller should become the offerer.
|
||||
//TODO: Remove join endpoint and redo its logic in correct locations
|
||||
app.MapPost("/api/rtc/join", async (RtcJoinRequest request, RtcCallService rtcCallService) =>
|
||||
{
|
||||
return Results.Ok(await rtcCallService.JoinCallAsync(request.ChannelId, request.Username));
|
||||
});
|
||||
|
||||
// Store or update the current SDP offer for a channel call.
|
||||
app.MapPost("/api/rtc/offer", async (RtcOffer request, RtcCallService rtcCallService) =>
|
||||
{
|
||||
await rtcCallService.WriteOfferAsync(request.ChannelId, request.Username, request.Sdp);
|
||||
return Results.Ok();
|
||||
});
|
||||
|
||||
// List all offers.
|
||||
app.MapGet("/api/rtc/offers", async (RtcCallService rtcCallService) =>
|
||||
{
|
||||
return Results.Ok(await rtcCallService.GetOffersAsync());
|
||||
|
||||
});
|
||||
|
||||
// Return whether the specified channel currently has an active call.
|
||||
|
||||
Reference in New Issue
Block a user