mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-25 06:49:23 +00:00
Upgrade call information
This commit is contained in:
parent
29736cd98d
commit
3cae1220c3
@ -53,7 +53,9 @@ export class CallsController {
|
||||
await this.MakeUserLeaveCall(convID, c)
|
||||
|
||||
|
||||
h.wsClient.activeCalls.add(convID);
|
||||
h.wsClient.activeCalls.set(convID, {
|
||||
ready: false
|
||||
});
|
||||
|
||||
// Notify all other users
|
||||
await UserWebSocketController.SendToSpecifcClients(
|
||||
@ -102,7 +104,10 @@ export class CallsController {
|
||||
|
||||
h.send(UserWebSocketController.active_clients.filter(
|
||||
(f) => f.activeCalls.has(convID)
|
||||
).map(f => f.userID))
|
||||
).map(f => {return {
|
||||
userID: f.userID,
|
||||
ready: f.activeCalls.get(convID).ready
|
||||
}}))
|
||||
}
|
||||
|
||||
/**
|
||||
@ -191,7 +196,7 @@ export class CallsController {
|
||||
// Listen for websocket closed
|
||||
EventsHelper.Listen("user_ws_closed", async w => {
|
||||
for(const convID of w.client.activeCalls)
|
||||
await CallsController.MakeUserLeaveCall(convID, w.client)
|
||||
await CallsController.MakeUserLeaveCall(convID[0], w.client)
|
||||
});
|
||||
|
||||
// Listen to signal from RTC proxy
|
||||
@ -203,6 +208,6 @@ EventsHelper.Listen("rtc_relay_signal", async msg => {
|
||||
EventsHelper.Listen("rtc_relay_ws_closed", async () => {
|
||||
for(const client of UserWebSocketController.active_clients) {
|
||||
for(const convID of client.activeCalls)
|
||||
await CallsController.MakeUserLeaveCall(convID, client);
|
||||
await CallsController.MakeUserLeaveCall(convID[0], client);
|
||||
}
|
||||
})
|
||||
|
@ -21,6 +21,10 @@ interface PendingRequests {
|
||||
incognito: boolean
|
||||
}
|
||||
|
||||
export interface CallStatus {
|
||||
ready: boolean
|
||||
}
|
||||
|
||||
export interface ActiveClient {
|
||||
socketID: string,
|
||||
clientID: number,
|
||||
@ -30,7 +34,7 @@ export interface ActiveClient {
|
||||
|
||||
registeredConversations: Set<number>,
|
||||
registeredPosts: Set<number>,
|
||||
activeCalls: Set<number>,
|
||||
activeCalls: Map<number, CallStatus>, // number = conversations id
|
||||
}
|
||||
|
||||
// Tokens are valid only 10 seconds after they are generated
|
||||
@ -123,7 +127,7 @@ export class UserWebSocketController {
|
||||
incognito: entry.incognito,
|
||||
registeredConversations: new Set(),
|
||||
registeredPosts: new Set(),
|
||||
activeCalls: new Set(),
|
||||
activeCalls: new Map(),
|
||||
}
|
||||
this.active_clients.push(client);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user