Skip to content

Commit 670696f

Browse files
author
Aleix Morgadas
committed
private unsubscription message
1 parent 200b48d commit 670696f

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

src/infrastructure/Listener.ts

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ export class Listener {
189189
share(),
190190
filter((_) => _.channelName === ListenerChannelName.block),
191191
filter((_) => _.message instanceof BlockInfo),
192-
map((_) => _.message as BlockInfo),);
192+
map((_) => _.message as BlockInfo));
193193
}
194194

195195
/**
@@ -206,7 +206,7 @@ export class Listener {
206206
filter((_) => _.channelName === ListenerChannelName.confirmedAdded),
207207
filter((_) => _.message instanceof Transaction),
208208
map((_) => _.message as Transaction),
209-
filter((_) => this.transactionFromAddress(_, address)),);
209+
filter((_) => this.transactionFromAddress(_, address)));
210210
}
211211

212212
/**
@@ -223,7 +223,7 @@ export class Listener {
223223
filter((_) => _.channelName === ListenerChannelName.unconfirmedAdded),
224224
filter((_) => _.message instanceof Transaction),
225225
map((_) => _.message as Transaction),
226-
filter((_) => this.transactionFromAddress(_, address)),);
226+
filter((_) => this.transactionFromAddress(_, address)));
227227
}
228228

229229
/**
@@ -239,7 +239,7 @@ export class Listener {
239239
return this.messageSubject.asObservable().pipe(
240240
filter((_) => _.channelName === ListenerChannelName.unconfirmedRemoved),
241241
filter((_) => typeof _.message === 'string'),
242-
map((_) => _.message as string),);
242+
map((_) => _.message as string));
243243
}
244244

245245
/**
@@ -256,7 +256,7 @@ export class Listener {
256256
filter((_) => _.channelName === ListenerChannelName.aggregateBondedAdded),
257257
filter((_) => _.message instanceof AggregateTransaction),
258258
map((_) => _.message as AggregateTransaction),
259-
filter((_) => this.transactionFromAddress(_, address)),);
259+
filter((_) => this.transactionFromAddress(_, address)));
260260
}
261261

262262
/**
@@ -272,7 +272,7 @@ export class Listener {
272272
return this.messageSubject.asObservable().pipe(
273273
filter((_) => _.channelName === ListenerChannelName.aggregateBondedRemoved),
274274
filter((_) => typeof _.message === 'string'),
275-
map((_) => _.message as string),);
275+
map((_) => _.message as string));
276276
}
277277

278278
/**
@@ -288,7 +288,7 @@ export class Listener {
288288
return this.messageSubject.asObservable().pipe(
289289
filter((_) => _.channelName === ListenerChannelName.status),
290290
filter((_) => _.message instanceof TransactionStatusError),
291-
map((_) => _.message as TransactionStatusError),);
291+
map((_) => _.message as TransactionStatusError));
292292
}
293293

294294
/**
@@ -304,7 +304,7 @@ export class Listener {
304304
return this.messageSubject.asObservable().pipe(
305305
filter((_) => _.channelName === ListenerChannelName.cosignature),
306306
filter((_) => _.message instanceof CosignatureSignedTransaction),
307-
map((_) => _.message as CosignatureSignedTransaction),);
307+
map((_) => _.message as CosignatureSignedTransaction));
308308
}
309309

310310
/**
@@ -320,6 +320,18 @@ export class Listener {
320320
this.webSocket.send(JSON.stringify(subscriptionMessage));
321321
}
322322

323+
/**
324+
* @internal
325+
* @param channel - Channel to unsubscribe
326+
*/
327+
private unsubscribeTo(channel: string) {
328+
const unsubscribeMessage = {
329+
uid: this.uid,
330+
unsubscribe: channel,
331+
};
332+
this.webSocket.send(JSON.stringify(unsubscribeMessage));
333+
}
334+
323335
/**
324336
* @internal
325337
* Filters if a transaction has been initiated or signed by an address

0 commit comments

Comments
 (0)