mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-22 05:19:22 +00:00
Send a message through websocket for updated messages
This commit is contained in:
parent
f8e8bc8322
commit
a4dcf49d74
@ -143,7 +143,18 @@ export class UserWebSocketActions {
|
|||||||
* @param msgID Message ID
|
* @param msgID Message ID
|
||||||
*/
|
*/
|
||||||
public static async UpdatedConversationMessage(msgID: number) {
|
public static async UpdatedConversationMessage(msgID: number) {
|
||||||
console.info("Update conversation message " + msgID);
|
const msg = await ConversationsHelper.GetSingleMessage(msgID);
|
||||||
|
|
||||||
|
for(const client of UserWebSocketController.active_clients.filter(
|
||||||
|
e => e.registeredConversations.has(msg.convID))) {
|
||||||
|
|
||||||
|
UserWebSocketController.SendToClient(client, new WsMessage({
|
||||||
|
id: "",
|
||||||
|
title: "updated_conv_message",
|
||||||
|
data: ConversationsController.ConversationMessageToAPI(msg)
|
||||||
|
}))
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -317,7 +317,7 @@ export class ConversationsHelper {
|
|||||||
* @param messageID The ID of the message to get
|
* @param messageID The ID of the message to get
|
||||||
* @throws If the message was not found
|
* @throws If the message was not found
|
||||||
*/
|
*/
|
||||||
private static async GetSingleMessage(messageID: number) : Promise<ConversationMessage> {
|
public static async GetSingleMessage(messageID: number) : Promise<ConversationMessage> {
|
||||||
const row = await DatabaseHelper.QueryRow({
|
const row = await DatabaseHelper.QueryRow({
|
||||||
table: MESSAGES_TABLE,
|
table: MESSAGES_TABLE,
|
||||||
where: {
|
where: {
|
||||||
|
Loading…
Reference in New Issue
Block a user