mirror of
https://github.com/hexastack/hexabot
synced 2025-04-01 08:15:07 +00:00
Merge pull request #820 from Hexastack/810-investigate-sync-message-cross-browser-tabsmultiple-users-using-the-same-account
fix: synchronized sent messages cross account tabs
This commit is contained in:
commit
e0a77302cc
@ -47,6 +47,19 @@ export class ChatService {
|
|||||||
private readonly attachmentService: AttachmentService,
|
private readonly attachmentService: AttachmentService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Synchronize sent messages cross opened websocket connections of the same account
|
||||||
|
*
|
||||||
|
* @param event - The received event
|
||||||
|
*/
|
||||||
|
private broadcastSentMessages(event: EventWrapper<any, any>) {
|
||||||
|
this.websocketGateway.broadcast(
|
||||||
|
event.getSender(),
|
||||||
|
event.getEventType(),
|
||||||
|
event._adapter.raw,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ends a given conversation (sets active to false)
|
* Ends a given conversation (sets active to false)
|
||||||
*
|
*
|
||||||
@ -268,6 +281,7 @@ export class ChatService {
|
|||||||
// Already existing user profile
|
// Already existing user profile
|
||||||
// Exec lastvisit hook
|
// Exec lastvisit hook
|
||||||
this.eventEmitter.emit('hook:user:lastvisit', subscriber);
|
this.eventEmitter.emit('hook:user:lastvisit', subscriber);
|
||||||
|
this.broadcastSentMessages(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.websocketGateway.broadcastSubscriberUpdate(subscriber);
|
this.websocketGateway.broadcastSubscriberUpdate(subscriber);
|
||||||
|
Loading…
Reference in New Issue
Block a user