coreflow/ts/coreflow.connector.coretrafficconnector.ts

34 lines
1.1 KiB
TypeScript
Raw Permalink Normal View History

2024-05-08 22:05:16 +00:00
import * as plugins from './coreflow.plugins.js';
import { Coreflow } from './coreflow.classes.coreflow.js';
import { logger } from './coreflow.logging.js';
export class CoretrafficConnector {
public coreflowRef: Coreflow;
public readyDeferred = plugins.smartpromise.defer();
constructor(coreflowRefArg: Coreflow) {
this.coreflowRef = coreflowRefArg;
}
public async start() {
// any work necessary to get connected
this.readyDeferred.resolve();
}
public async setReverseConfigs(
reverseConfigsArg: plugins.servezoneInterfaces.data.IReverseProxyConfig[]
) {
await this.start();
const reactionRequest =
this.coreflowRef.internalServer.typedsocketServer.createTypedRequest<plugins.servezoneInterfaces.requests.routing.IRequest_Coreflow_Coretraffic_RoutingUpdate>(
'updateRouting',
await this.coreflowRef.internalServer.typedsocketServer.findTargetConnection(
async (targetConnection) => targetConnection.alias === 'coretraffic'
)
);
const response = await reactionRequest.fire({
reverseConfigs: reverseConfigsArg,
});
}
}