mirror of
https://github.com/hexastack/hexabot
synced 2025-03-30 15:19:41 +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,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
*
|
||||
@ -268,6 +281,7 @@ export class ChatService {
|
||||
// Already existing user profile
|
||||
// Exec lastvisit hook
|
||||
this.eventEmitter.emit('hook:user:lastvisit', subscriber);
|
||||
this.broadcastSentMessages(event);
|
||||
}
|
||||
|
||||
this.websocketGateway.broadcastSubscriberUpdate(subscriber);
|
||||
|
Loading…
Reference in New Issue
Block a user