1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-12-26 13:38:52 +00:00

Returns calls configuration to client

This commit is contained in:
Pierre HUBERT 2020-04-11 08:19:52 +02:00
parent cb9bd06cdc
commit b8c19a8875
2 changed files with 19 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import { ActiveClient, UserWebSocketController } from "./UserWebSocketController
import { EventsHelper } from "../helpers/EventsHelper";
import * as ws from 'ws'
import { WsMessage } from "../entities/WsMessage";
import { conf } from "../helpers/ConfigHelper";
/**
* Legacy calls controller
@ -22,6 +23,22 @@ export class CallsController {
});
}
/**
* Get call configuration
*
* @param h Request handler
*/
public static async GetConfig(h: UserWebSocketRequestsHandler) {
// Check if user is member of at least one call
if(h.wsClient.activeCalls.size == 0)
h.error(401, "You do not belong to any call for now!")
h.send({
iceServers: conf().rtc_relay.iceServers
})
}
/**
* Join a call
*

View File

@ -33,6 +33,8 @@ export const UserWebSocketRoutes: UserWebSocketRoute[] = [
// Calls controller
{title: "calls/config", handler: (h) => CallsController.GetConfig(h)},
{title: "calls/join", handler: (h) => CallsController.JoinCall(h)},
{title: "calls/leave", handler: (h) => CallsController.LeaveCall(h)},