fix(core): update
This commit is contained in:
43
ts/coretraffic.classes.coreflowconnector.ts
Normal file
43
ts/coretraffic.classes.coreflowconnector.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import * as plugins from './coretraffic.plugins.js';
|
||||
import { logger } from './coretraffic.logging.js';
|
||||
import { CoreTraffic } from './coretraffic.classes.coretraffic.js';
|
||||
|
||||
/**
|
||||
* Coreflow Connector
|
||||
*/
|
||||
export class CoreflowConnector {
|
||||
public typedrouter = new plugins.typedrequest.TypedRouter();
|
||||
public coretrafficRef: CoreTraffic;
|
||||
public typesocketClient: plugins.typedsocket.TypedSocket;
|
||||
|
||||
constructor(coretrafficRefArg: CoreTraffic) {
|
||||
this.coretrafficRef = coretrafficRefArg;
|
||||
this.coretrafficRef.typedrouter.addTypedRouter(this.typedrouter)
|
||||
|
||||
this.typedrouter.addTypedHandler<
|
||||
plugins.lointCloudly.request.routing.IRequest_Coreflow_Coretraffic_RoutingUpdate
|
||||
>(new plugins.typedrequest.TypedHandler('updateRouting', async (requestData) => {
|
||||
console.log(requestData);
|
||||
await this.coretrafficRef.taskmanager.setupRoutingTask.trigger(requestData.reverseConfigs);
|
||||
return {
|
||||
status: 'ok',
|
||||
errorText: ''
|
||||
};
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* starts the corechatConnector
|
||||
*/
|
||||
public async start() {
|
||||
this.typesocketClient = await plugins.typedsocket.TypedSocket.createClient(
|
||||
this.typedrouter,
|
||||
'http://coreflow:3000',
|
||||
'coretraffic'
|
||||
);
|
||||
}
|
||||
|
||||
public async stop() {
|
||||
await this.typesocketClient.stop();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user