simplify websocket opening and response types from BE

This commit is contained in:
Matt Hill
2022-08-15 16:59:05 -06:00
parent ebbb347128
commit 4aadfed740
5 changed files with 27 additions and 82 deletions

View File

@@ -1,13 +1,11 @@
import { Observable } from 'rxjs'
import { map } from 'rxjs/operators'
import { Update } from '../types'
import { Source } from './source'
import { RPCResponse } from './ws-source'
export class MockSource<T> implements Source<T> {
constructor(private readonly seed: Observable<Update<T>>) {}
watch$(): Observable<RPCResponse<Update<T>>> {
return this.seed.pipe(map(result => ({ result, jsonrpc: '2.0' })))
watch$(): Observable<Update<T>> {
return this.seed
}
}