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