Files
coreflow/ts/coreflow.classes.internalserver.ts
T

32 lines
849 B
TypeScript
Raw Normal View History

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