format import { SecureServerConfig } from '../utils/CertificateProvider' ; import ServerAdapter , { ServerEventsListener } from './ServerAdapter' ; import ServerRSocket from './ServerRSocket' ; import SecureServerWebSocket from './SecureServerWebSocket' ; import BrowserServerWebSocket from './BrowserServerWebSocket' ; import ServerWebSocket from './ServerWebSocket' ; export enum TransportType { RSocket , WebSocket } param port param listener param sslConfig export async function createServer ( port , listener , sslConfig ? , transportType = TransportType . RSocket ) { let server ; if ( transportType === TransportType . RSocket ) { server = new ServerRSocket ( listener ) ; } else if ( sslConfig ) { server = new SecureServerWebSocket ( listener ) ; } else { server = new ServerWebSocket ( listener ) ; } await server . start ( port , sslConfig ) ; return server ; } param port param listener returns export async function createBrowserServer ( port , listener ) { const server = new BrowserServerWebSocket ( listener ) ; await server . start ( port ) ; return server ; }