import { NgModule } from '@angular/core'; import { RPCModule } from '@loafer/ng-rpc'; import { RPC_CODEC, RPC_RWC, JSONRPCClientCodec, RPCClientWebsocketRWC, RxWebsocketSubjectConfig, } from '@loafer/ng-rpc'; import { environment } from '../environments/environment'; @NgModule({ exports: [ RPCModule, ], imports: [ RPCModule.forRoot([]), ], providers: [ {provide: 'WEBAPP_RPC_CONFIG', useValue: environment.webappRPCConfig}, {provide: RPC_CODEC, useFactory: () => new JSONRPCClientCodec()}, { provide: RPC_RWC, useFactory: (config: RxWebsocketSubjectConfig) => new RPCClientWebsocketRWC(config), deps: ['WEBAPP_RPC_CONFIG'] }, ] }) export class AppRPCModule { }