1 import chalk from
'chalk';
3 import { ServerOptions
} from
'../../types/ConfigurationData';
4 import { ApplicationProtocol
} from
'../../types/UIProtocol';
5 import Configuration from
'../../utils/Configuration';
6 import { AbstractUIServer
} from
'./AbstractUIServer';
7 import { UIServiceUtils
} from
'./ui-services/UIServiceUtils';
8 import UIWebSocketServer from
'./UIWebSocketServer';
10 export default class UIServerFactory
{
11 private constructor() {
12 // This is intentional
15 public static getUIServerImplementation(
16 applicationProtocol
: ApplicationProtocol
,
17 options
?: ServerOptions
18 ): AbstractUIServer
| null {
19 if (!UIServiceUtils
.isLoopback(options
?.host
)) {
22 'Loopback address not detected in UI server configuration. This is not recommended.'
26 switch (applicationProtocol
) {
27 case ApplicationProtocol
.WS
:
28 return new UIWebSocketServer(options
?? Configuration
.getUIServer().options
);