member_webapp/src/app/app-rpc.module.ts

35 lines
733 B
TypeScript
Raw Normal View History

2018-04-06 06:59:49 +00:00
import { NgModule } from '@angular/core';
import { RPCModule } from '@loafer/ng-rpc';
import {
RPC_CODEC,
RPC_RWC,
2018-05-24 06:44:13 +00:00
JSONRPCClientCodec,
2018-04-06 06:59:49 +00:00
RPCClientWebsocketRWC,
RxWebsocketSubjectConfig,
2018-05-24 06:44:13 +00:00
} from '@loafer/ng-rpc';
2018-04-06 06:59:49 +00:00
import { environment } from '../environments/environment';
@NgModule({
exports: [
RPCModule,
],
imports: [
2018-05-24 06:44:13 +00:00
RPCModule.forRoot([]),
2018-04-06 06:59:49 +00:00
],
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 { }