1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-24 22:39:21 +00:00

Can mark a user as ready

This commit is contained in:
Pierre HUBERT 2020-04-11 14:39:17 +02:00
parent 3cae1220c3
commit 38858e956d
2 changed files with 24 additions and 0 deletions

View File

@ -170,6 +170,28 @@ export class CallsController {
} }
/**
* Mark a user as ready to share its streams
*
* @param h Request handler
*/
public static async MarkUserReady(h: UserWebSocketRequestsHandler) {
const callID = h.postCallId("callID");
h.wsClient.activeCalls.get(callID).ready = true;
// Notify all other users
await UserWebSocketController.SendToSpecifcClients(
(c) => c.activeCalls.has(callID) && c.userID != h.getUserId(),
() => WsMessage.NoIDMessage("user_ready", {
callID: callID,
userID: h.getUserId()
})
)
h.success();
}
/** /**
* Make the client leave the call * Make the client leave the call
* *

View File

@ -42,4 +42,6 @@ export const UserWebSocketRoutes: UserWebSocketRoute[] = [
{title: "calls/members", handler: (h) => CallsController.GetMembersList(h)}, {title: "calls/members", handler: (h) => CallsController.GetMembersList(h)},
{title: "calls/signal", handler: (h) => CallsController.OnClientSignal(h)}, {title: "calls/signal", handler: (h) => CallsController.OnClientSignal(h)},
{title: "calls/mark_ready", handler: (h) => CallsController.MarkUserReady(h)},
] ]