2024-05-09 00:05:16 +02:00
|
|
|
import { Coreflow } from './coreflow.classes.coreflow.js';
|
|
|
|
|
import * as plugins from './coreflow.plugins.js';
|
|
|
|
|
|
|
|
|
|
export class InternalServer {
|
|
|
|
|
public coreflowRef: Coreflow;
|
2026-04-28 12:02:22 +00:00
|
|
|
public smartServe: plugins.smartserve.SmartServe;
|
|
|
|
|
public typedsocketServer!: plugins.typedsocket.TypedSocket;
|
2024-05-09 00:05:16 +02:00
|
|
|
|
|
|
|
|
constructor(coreflowRefArg: Coreflow) {
|
|
|
|
|
this.coreflowRef = coreflowRefArg;
|
2026-04-28 12:02:22 +00:00
|
|
|
this.smartServe = new plugins.smartserve.SmartServe({
|
|
|
|
|
port: 3000,
|
|
|
|
|
websocket: {
|
|
|
|
|
typedRouter: this.coreflowRef.typedrouter,
|
|
|
|
|
},
|
|
|
|
|
});
|
2024-05-09 00:05:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async start() {
|
2026-04-28 12:02:22 +00:00
|
|
|
await this.smartServe.start();
|
|
|
|
|
this.typedsocketServer = plugins.typedsocket.TypedSocket.fromSmartServe(
|
|
|
|
|
this.smartServe,
|
2024-12-29 14:14:46 +01:00
|
|
|
this.coreflowRef.typedrouter,
|
2024-05-09 00:05:16 +02:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async stop() {
|
|
|
|
|
await this.typedsocketServer.stop();
|
2026-04-28 12:02:22 +00:00
|
|
|
await this.smartServe.stop();
|
2024-05-09 00:05:16 +02:00
|
|
|
}
|
|
|
|
|
}
|