import chalk from 'chalk';
-import { ServerOptions } from '../../types/ConfigurationData';
+import type { UIServerConfiguration } from '../../types/ConfigurationData';
import { ApplicationProtocol } from '../../types/UIProtocol';
import Configuration from '../../utils/Configuration';
-import { AbstractUIServer } from './AbstractUIServer';
+import type { AbstractUIServer } from './AbstractUIServer';
import { UIServiceUtils } from './ui-services/UIServiceUtils';
+import UIHttpServer from './UIHttpServer';
import UIWebSocketServer from './UIWebSocketServer';
export default class UIServerFactory {
public static getUIServerImplementation(
applicationProtocol: ApplicationProtocol,
- options?: ServerOptions
+ uiServerConfiguration?: UIServerConfiguration
): AbstractUIServer | null {
- if (!UIServiceUtils.isLoopback(options?.host)) {
+ if (UIServiceUtils.isLoopback(uiServerConfiguration.options?.host) === false) {
console.warn(
chalk.magenta(
'Loopback address not detected in UI server configuration. This is not recommended.'
}
switch (applicationProtocol) {
case ApplicationProtocol.WS:
- return new UIWebSocketServer(options ?? Configuration.getUIServer().options);
+ return new UIWebSocketServer(uiServerConfiguration ?? Configuration.getUIServer());
+ case ApplicationProtocol.HTTP:
+ return new UIHttpServer(uiServerConfiguration ?? Configuration.getUIServer());
default:
return null;
}