Skip to content

Commit

Permalink
Jitsi (#8)
Browse files Browse the repository at this point in the history
* Added video chat message type

* Added room to videochat route
  • Loading branch information
jzongker authored Apr 21, 2021
1 parent f462e4f commit 9a40066
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/controllers/ConversationController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ import { DeliveryHelper } from "../helpers/DeliveryHelper";

@controller("/conversations")
export class ConversationController extends MessagingBaseController {

@httpGet("/:videoChat/:connectionId/:room")
public async videoChat(@requestParam("connectionId") connectionId: string, @requestParam("room") room: string, req: express.Request<{}, {}, []>, res: express.Response): Promise<any> {
return this.actionWrapper(req, res, async (au) => {
if (!au.checkAccess(Permissions.chat.host)) return this.json({}, 401);
else {
const connection: Connection = await this.repositories.connection.loadById(au.churchId, connectionId);
if (connection !== null) {
await DeliveryHelper.sendMessage(connection, { churchId: au.churchId, conversationId: connection.conversationId, action: "videoChatInvite", data: room });
return {}
}
}
});
}

@httpGet("/:privateMessage/:connectionId")
public async privateMessage(@requestParam("connectionId") connectionId: string, req: express.Request<{}, {}, []>, res: express.Response): Promise<any> {
return this.actionWrapper(req, res, async (au) => {
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/Interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import WebSocket from "ws";

export type PayloadAction = "message" | "deleteMessage" | "callout" | "attendance" | "prayerRequest" | "socketId" | "privateMessage" | "privateRoomAdded";
export type PayloadAction = "message" | "deleteMessage" | "callout" | "attendance" | "prayerRequest" | "socketId" | "privateMessage" | "privateRoomAdded" | "videoChatInvite";

export interface PayloadInterface { churchId: string, conversationId: string, action: PayloadAction, data: any }
export interface AttendanceInterface { viewers?: ViewerInterface[], totalViewers?: number, conversationId: string }
Expand Down

0 comments on commit 9a40066

Please sign in to comment.