Even more documentation
This commit is contained in:
+38
-1
@@ -1,18 +1,55 @@
|
||||
import { types } from "@aas-core-works/aas-core3.0-typescript";
|
||||
import type { Request, OnRequestCallback } from "./types/requests";
|
||||
import type { OnRequestCallback } from "./types/requests";
|
||||
|
||||
/**
|
||||
* Abstract class for an interface server.
|
||||
* This should be used as base class for your own interface servers!
|
||||
*
|
||||
* @typeParam ConfigInterface - The config interface for your interface server.
|
||||
*/
|
||||
export default abstract class AASInterfaceServer<ConfigInterface> {
|
||||
/**
|
||||
* A name for your interface server.
|
||||
* @remarks
|
||||
* Currently unused
|
||||
*/
|
||||
public static readonly serverInterfaceName: string;
|
||||
/**
|
||||
* Whether your interface server supports subscriptions.
|
||||
* @remarks
|
||||
* Currently unused
|
||||
*/
|
||||
public static readonly supportsSubscriptions: boolean;
|
||||
|
||||
/**
|
||||
* Crate the interface server.
|
||||
* @param config Interface server config
|
||||
* @param aas AAS Environment for the server
|
||||
* @param onRequestCallback Callback when a request is received and parsed
|
||||
*/
|
||||
constructor(
|
||||
protected readonly config: ConfigInterface,
|
||||
protected readonly aas: types.Environment,
|
||||
protected readonly onRequestCallback: OnRequestCallback) {}
|
||||
|
||||
/**
|
||||
* Prepare the interface server.
|
||||
* @remarks
|
||||
* Here you can create routes, listeners, callbacks,...
|
||||
*/
|
||||
public abstract prepare(): void;
|
||||
/**
|
||||
* Run the interface server.
|
||||
*/
|
||||
public abstract run(): void;
|
||||
/**
|
||||
* Stop the interface server.
|
||||
*/
|
||||
public abstract stop(): void;
|
||||
/**
|
||||
* Notify observers/subscribers about an event.
|
||||
* @param event Event to notify the interface server about
|
||||
*/
|
||||
public abstract notify(event: any): void;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user