mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-22 13:29:22 +00:00
Propagate closing of RTC websocket
This commit is contained in:
parent
36859bbd6d
commit
431463967b
@ -95,4 +95,10 @@ EventsHelper.Listen("user_ws_closed", async w => {
|
|||||||
await CallsController.MakeUserLeaveCall(convID, w.client)
|
await CallsController.MakeUserLeaveCall(convID, w.client)
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO : close all call when RTC WS is closed
|
// Close all call when RTC WS is closed
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import * as ws from 'ws';
|
import * as ws from 'ws';
|
||||||
import { Request } from 'express';
|
import { Request } from 'express';
|
||||||
import { conf } from '../helpers/ConfigHelper';
|
import { conf } from '../helpers/ConfigHelper';
|
||||||
|
import { EventsHelper } from '../helpers/EventsHelper';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RTC WebSocket relay controller
|
* RTC WebSocket relay controller
|
||||||
@ -91,7 +92,8 @@ export class RTCRelayController {
|
|||||||
|
|
||||||
console.info("Closed a connection to RTC relay");
|
console.info("Closed a connection to RTC relay");
|
||||||
|
|
||||||
// TODO : do cleanup
|
// Propagate information
|
||||||
|
await EventsHelper.Emit("rtc_relay_ws_closed", {});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -9,6 +9,9 @@ import { ActiveClient } from "../controllers/UserWebSocketController";
|
|||||||
* @author Pierre Hubert
|
* @author Pierre Hubert
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// When RTC Relay WebSocket is closed
|
||||||
|
export interface ClosedRelayWebSocketEvent {}
|
||||||
|
|
||||||
// When a user sign out
|
// When a user sign out
|
||||||
export interface DestroyedLoginTokensEvent {
|
export interface DestroyedLoginTokensEvent {
|
||||||
userID: number,
|
userID: number,
|
||||||
@ -64,6 +67,7 @@ export interface CommentDeletedEvent {
|
|||||||
* Global map of all possible events
|
* Global map of all possible events
|
||||||
*/
|
*/
|
||||||
export interface EventsMap {
|
export interface EventsMap {
|
||||||
|
"rtc_relay_ws_closed": ClosedRelayWebSocketEvent,
|
||||||
"destroyed_login_tokens": DestroyedLoginTokensEvent,
|
"destroyed_login_tokens": DestroyedLoginTokensEvent,
|
||||||
"user_ws_closed": UserWebSocketClosedEvent,
|
"user_ws_closed": UserWebSocketClosedEvent,
|
||||||
"updated_number_notifications": UpdatedNotificationsNumberEvent,
|
"updated_number_notifications": UpdatedNotificationsNumberEvent,
|
||||||
|
Loading…
Reference in New Issue
Block a user