vani-meeting-server 1.7.0 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -18,7 +18,10 @@ export declare class RedisHandler {
|
|
|
18
18
|
cleanUp(): Promise<string>;
|
|
19
19
|
cleanUpRoomId(roomId: string): Promise<void>;
|
|
20
20
|
setIpForRoomId(roomId: string, ipAddress: string): Promise<void>;
|
|
21
|
-
fetchIpsForRoomId(roomId: string): Promise<
|
|
21
|
+
fetchIpsForRoomId(roomId: string): Promise<{
|
|
22
|
+
ip: string;
|
|
23
|
+
port: number;
|
|
24
|
+
}[]>;
|
|
22
25
|
storeMesagesForRoom(roomId: string, messagePayload: MessagePayload): Promise<void>;
|
|
23
26
|
fetchMessagesForRoom(roomId: string): Promise<MessagePayload[]>;
|
|
24
27
|
storeMeetingTimeForRoom(roomId: string, time?: number): Promise<void>;
|
|
@@ -51,19 +51,22 @@ class RedisHandler {
|
|
|
51
51
|
//ip addresss
|
|
52
52
|
async setIpForRoomId(roomId, ipAddress) {
|
|
53
53
|
const oldIps = await this.fetchIpsForRoomId(roomId);
|
|
54
|
-
const isOldIpPresent = oldIps.find((eachOldIp) => eachOldIp === ipAddress);
|
|
54
|
+
const isOldIpPresent = oldIps.find((eachOldIp) => eachOldIp.ip === ipAddress && eachOldIp.port === ServerHandler_1.ServerHandler.getInstance().serverStartRequest.port);
|
|
55
55
|
if (isOldIpPresent) {
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
|
-
oldIps.push(ipAddress);
|
|
58
|
+
oldIps.push({ ip: ipAddress, port: ServerHandler_1.ServerHandler.getInstance().serverStartRequest.port });
|
|
59
59
|
await this.redisClient.hSet(roomId, RedisKeyType.IpAddress, JSON.stringify(oldIps));
|
|
60
|
+
this.fetchIpsForRoomId(roomId);
|
|
60
61
|
}
|
|
61
62
|
async fetchIpsForRoomId(roomId) {
|
|
62
63
|
const ipAddress = await this.redisClient.hGet(roomId, RedisKeyType.IpAddress);
|
|
63
64
|
if (ipAddress) {
|
|
65
|
+
console.log("fetchIpsForRoomId", JSON.parse(ipAddress));
|
|
64
66
|
return JSON.parse(ipAddress);
|
|
65
67
|
}
|
|
66
68
|
else {
|
|
69
|
+
console.log("fetchIpsForRoomId", []);
|
|
67
70
|
return [];
|
|
68
71
|
}
|
|
69
72
|
}
|
|
@@ -63,15 +63,16 @@ class SFUEachRoomHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
|
|
|
63
63
|
this.informOtherSystems();
|
|
64
64
|
}
|
|
65
65
|
informOtherSystems = async () => {
|
|
66
|
+
console.log("informOtherSystems");
|
|
66
67
|
const allIps = await RedisHandler_1.RedisHandler.getInstance().fetchIpsForRoomId(this.roomId);
|
|
67
68
|
allIps.forEach((async (eachIp) => {
|
|
68
|
-
if (eachIp !== await Constant_1.default.getPublicIp()) {
|
|
69
|
+
if (eachIp.ip !== await Constant_1.default.getPublicIp() && eachIp.port !== ServerHandler_1.ServerHandler.getInstance().serverStartRequest.port) {
|
|
69
70
|
const port = await pickPort({ reserveTimeout: 120 });
|
|
70
71
|
console.log("Free port", port);
|
|
71
72
|
const pipeTransport = await this.sendRouter?.createPipeTransport({ listenIp: { ip: '0.0.0.0', announcedIp: await Constant_1.default.getPublicIp() }, port: port });
|
|
72
73
|
if (pipeTransport) {
|
|
73
|
-
this.pipeTransports[eachIp] = pipeTransport;
|
|
74
|
-
this.redisBroadcastMessageToTopic(this.roomId, this.prepareMutilSystemEvents(EachSocketConnectionHandler_1.MultiSystemEvents.OnNewServerJoinedForRoom, Utility_1.Utility.getTopicForRoomIdAndIp(this.roomId, eachIp), { ip: await Constant_1.default.getPublicIp(), port: port }));
|
|
74
|
+
this.pipeTransports[eachIp.ip] = pipeTransport;
|
|
75
|
+
this.redisBroadcastMessageToTopic(this.roomId, this.prepareMutilSystemEvents(EachSocketConnectionHandler_1.MultiSystemEvents.OnNewServerJoinedForRoom, Utility_1.Utility.getTopicForRoomIdAndIp(this.roomId, eachIp.ip), { ip: await Constant_1.default.getPublicIp(), port: port }));
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
}));
|