vani-meeting-server 1.6.4 → 1.6.5

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.
@@ -1,4 +1,5 @@
1
1
  import { RedisHandler } from "./lib/redis/RedisHandler";
2
+ import { MessagePayload } from "./models/MessagePayload";
2
3
  import { Participant } from "./models/Participant";
3
4
  import { WebSocketServerStartRequest } from "./models/WebSocketServerStartRequest";
4
5
  import { SFUHandler } from "./sfu/SFUHandler";
@@ -29,5 +30,6 @@ export declare class ServerHandler {
29
30
  startPlainTransportForBroadcasting(plainTransportPayload: PlainTransportPayload, forRoomid: string): Promise<void>;
30
31
  resumePlainTransportForBroadcasting(forRoomid: string): Promise<void>;
31
32
  getAllOnGoingMeetingRoomIds(): Promise<string[] | undefined>;
33
+ sendMessage(messagePayload: MessagePayload, to: string): Promise<void>;
32
34
  getAllParticipatnsForRoomId(roomId: string): Promise<Participant[]>;
33
35
  }
@@ -2,9 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ServerHandler = void 0;
4
4
  const RedisHandler_1 = require("./lib/redis/RedisHandler");
5
+ const Participant_1 = require("./models/Participant");
5
6
  const WebSocketServerStartRequest_1 = require("./models/WebSocketServerStartRequest");
6
7
  const SFUHandler_1 = require("./sfu/SFUHandler");
8
+ const EachSocketConnectionHandler_1 = require("./websocket/EachSocketConnectionHandler");
7
9
  const WebSocketHandler_1 = require("./websocket/WebSocketHandler");
10
+ const uuid_1 = require("uuid");
8
11
  class ServerHandler {
9
12
  serverStartRequest = new WebSocketServerStartRequest_1.WebSocketServerStartRequest();
10
13
  rediHandler;
@@ -38,6 +41,12 @@ class ServerHandler {
38
41
  async getAllOnGoingMeetingRoomIds() {
39
42
  return await this.rediHandler?.getAllRoomsId();
40
43
  }
44
+ async sendMessage(messagePayload, to) {
45
+ const tempParticipant = new Participant_1.Participant();
46
+ tempParticipant.userId = (0, uuid_1.v4)();
47
+ const clientMessageBody = { shouldSendToSelf: true, senderParticipant: tempParticipant, interfaceName: 'ClientMessageBody', broadcastMessage: { type: EachSocketConnectionHandler_1.WebSocketBasicEvents.Message, data: messagePayload, interfaceName: 'WebSocketMessageBody' } };
48
+ RedisHandler_1.RedisHandler.getInstance().redisPublisher.publish(to, JSON.stringify(clientMessageBody));
49
+ }
41
50
  async getAllParticipatnsForRoomId(roomId) {
42
51
  return await RedisHandler_1.RedisHandler.getInstance().getAllParticipants(roomId);
43
52
  }
@@ -186,7 +186,6 @@ class EachSocketConnectionHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
186
186
  }
187
187
  else if (paylod.type === WebSocketBasicEvents.GetOldMessages) {
188
188
  const messages = await RedisHandler_1.RedisHandler.getInstance().fetchMessagesForRoom(this.selfParticipant?.roomId);
189
- console.log("GetOldMessages", messages);
190
189
  this.redisBroadcastMessageToTopic(this.selfParticipant?.userId, this.preapreClientMessageBody(true, this.selfParticipant, this.preapreWebSocketMessageBody(WebSocketBasicEvents.OnOldMessages, messages)));
191
190
  }
192
191
  else if (paylod.type === WebSocketBasicEvents.OnStartMeetingCalled) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vani-meeting-server",
3
- "version": "1.6.4",
3
+ "version": "1.6.5",
4
4
  "description": "Vani Meeting Server SDK",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",