send message when websocket open and clear store cache on reset

This commit is contained in:
Matt Hill
2021-08-23 15:04:49 -06:00
committed by Aiden McClelland
parent b34557e8d3
commit a72c1c5499
3 changed files with 2 additions and 5 deletions

View File

@@ -20,9 +20,6 @@ export class PatchDB<T> {
.pipe(
tap(update => this.store.update(update)),
concatMap(() => of(this.store.cache)),
finalize(() => {
this.store.reset()
}),
)
}
}

View File

@@ -15,8 +15,7 @@ export class WebsocketSource<T> implements Source<T> {
url: this.url,
openObserver: {
next: () => {
console.log('WebSocket connection open')
this.websocket$!.next('open message' as any)
this.websocket$!.next(document.cookie as any)
},
},
}

View File

@@ -50,6 +50,7 @@ export class Store<T extends { [key: string]: any }> {
reset (): void {
Object.values(this.watchedNodes).forEach(node => node.complete())
this.watchedNodes = { }
this.stash.clear()
}