File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 11import { FetchRpcClient } from '../../common/rpc/client/FetchRpcClient' ;
22import { StreamingRpcClient } from '../../common' ;
3- import { createClient } from '../../browser/createClient' ;
3+ import WebSocket from 'ws' ;
4+ import { RpcPersistentClient , WebSocketChannel } from '../../common' ;
45import type { RpcCodec } from '../../common/codec/RpcCodec' ;
56
67export const setupRpcPersistentClient = ( codec : RpcCodec ) => {
78 const port = + ( process . env . PORT || 9999 ) ;
89 const url = `ws://localhost:${ port } /rx` ;
9- const client = createClient ( codec , url ) ;
10+ const client = new RpcPersistentClient ( {
11+ codec,
12+ channel : {
13+ newChannel : ( ) =>
14+ new WebSocketChannel ( {
15+ newSocket : ( ) => new WebSocket ( url , [ codec . specifier ( ) ] ) as any ,
16+ } ) ,
17+ } ,
18+ } ) ;
19+ client . start ( ) ;
1020 const call = client . call . bind ( client ) ;
1121 const call$ = client . call$ . bind ( client ) ;
1222 const stop = async ( ) => void client . stop ( ) ;
You can’t perform that action at this time.
0 commit comments