member_webapp/src/app/app-rpc.module.ts
crusader d59d9379f9 ing
2018-05-24 15:44:13 +09:00

35 lines
733 B
TypeScript

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 { }