1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-10 05:13:29 +00:00

[PM-18044] Ensure all calls to receive should get all messages broadcast (#13869)

* feat: make compatible with SDK changes

* feat: use subscription

* feat: update SDK

* fix: lint

* fix: ts strict issues
This commit is contained in:
Andreas Coroiu
2025-05-05 18:19:41 +02:00
committed by GitHub
parent 60bafc1311
commit e0cabd1df0
8 changed files with 106 additions and 113 deletions

View File

@@ -2,7 +2,7 @@ import type { OutgoingMessage } from "@bitwarden/sdk-internal";
export interface IpcMessage {
type: "bitwarden-ipc-message";
message: OutgoingMessage;
message: Omit<OutgoingMessage, "free">;
}
export function isIpcMessage(message: any): message is IpcMessage {

View File

@@ -25,11 +25,11 @@ export abstract class IpcService {
this._client = client;
this._messages$ = new Observable<IncomingMessage>((subscriber) => {
let isSubscribed = true;
const receiveLoop = async () => {
const subscription = await this.client.subscribe();
while (isSubscribed) {
try {
const message = await this.client.receive();
const message = await subscription.receive();
subscriber.next(message);
} catch (error) {
subscriber.error(error);