123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- /* call server client service instance 3 times. */
- // Testing to isolate server client servicce
- import { Subject } from "rxjs";
- import { ConnectionRequest, Message } from "../interfaces/general.interface";
- import { ServerClientManager } from "../services/server-client.service";
- const serverClientManager = new ServerClientManager()
- let targetserver: string = 'localhost:3000'
- let targetserver2: string = 'localhost:3002'
- let hostServer: string = 'localhost:3001'
- let connectionRequest1: ConnectionRequest = {
- server: {
- name: 'G1',
- serverUrl: hostServer,
- connectionType: 'GRPC',
- messageToBePublishedFromApplication: new Subject<Message>()
- },
- client: {
- name: 'G2',
- targetServer: targetserver,
- connectionType: 'GRPC',
- messageToBeReceivedFromRemote: new Subject<Message>()
- }
- }
- let connectionRequest2: ConnectionRequest = {
- server: {
- name: 'G1',
- serverUrl: hostServer,
- connectionType: 'GRPC',
- messageToBePublishedFromApplication: new Subject<Message>()
- },
- client: {
- name: 'G0',
- targetServer: targetserver2,
- connectionType: 'GRPC',
- messageToBeReceivedFromRemote: new Subject<Message>()
- }
- }
- // Client 1 request connection
- serverClientManager.generateConnection(connectionRequest1).then((response) => {
- // console.log(response)
- serverClientManager.generateConnection(connectionRequest2).then((response) => {
- // console.log(response)
- serverClientManager.generateConnection(connectionRequest1);
- })
- })
- // Array size =1;
- // serverClientManager.generateConnection(connectionRequest2)
- // Client 2 request connection
- // Array size =2;
- // Client 1 request connection again
- // setTimeout(() => {
- // serverClientManager.generateConnection(connectionRequest1)
- // }, 4000)
- // Array size =2;
|