declare module lib_comm { /** * @author fenris */ type type_answering_executor = (message: type_message_in) => lib_call.type_executor; /** * @author fenris */ type type_answering_promise = (message: type_message_in) => lib_call.type_promise; /** * @author fenris */ type type_answering = type_answering_promise; } declare module lib_comm { } declare module lib_comm { /** * @author fenris */ interface interface_server { /** * @desc this method shall prepare the server to a point, where it just needs to be started afterwards * @param {type_answering} answering specifies how the server should handle incoming messages to formulate an answer * @author fenris */ setup(answering: type_answering): lib_call.type_promise; /** * @desc starts to listen * @author fenris */ run(): void; } } declare module lib_comm { /** * @author fenris */ type type_response_server_http = { code: int; text: string; }; /** * @author fenris */ type type_parameters_server_http = { protocol?: string; port?: int; headers?: { [name: string]: string; }; ssl_key?: string; ssl_cert?: string; ssl_ca?: string; }; /** * @author fenris */ var default_parameters_server_http: type_parameters_server_http; } declare module lib_comm { /** * @author fenris */ type type_server_http = { parameters: type_parameters_server_http; answering: type_answering; serverinstance: any; }; /** * @author fenris */ function server_http_construct(parameters?: type_parameters_server_http): type_server_http; /** * @author fenris */ function server_http_setup(subject: type_server_http, answering: type_answering): lib_call.type_promise; /** * @author fenris */ function server_http_run(subject: type_server_http): void; } declare module lib_comm { } declare module lib_comm { /** * @author fenris */ class class_server_http implements interface_server { /** * @author fenris */ protected subject: type_server_http; /** * @author fenris */ constructor(parameters?: type_parameters_server_http); /** * @author fenris * @implementation */ setup(answering: type_answering): lib_call.type_promise; /** * @author fenris * @implementation */ run(): void; } } declare module lib_comm { /** * @author fenris */ class class_server_mhttp implements interface_server { /** * @author fenris */ protected core: class_server_http; /** * @author fenris */ constructor(parameters?: type_parameters_server_http); /** * @author fenris * @implementation */ setup(answering: type_answering): lib_call.type_promise; /** * @author fenris * @implementation */ run(): void; } } declare module lib_comm { /** * @desc wrapper for string-based servers * @author fenris */ class class_server_complex implements interface_server { /** * @author fenris */ protected core: interface_server; /** * @author fenris */ protected code: lib_code.interface_code; /** * @author fenris */ constructor(core: interface_server, code?: lib_code.interface_code); /** * @author fenris * @implementation */ setup(answering: type_answering): lib_call.type_promise; /** * @author fenris * @implementation */ run(): void; } } declare module lib_comm { /** */ type type_server_common = { port: int; handle: (input: string) => Promise; verbosity: int; server: any; }; /** */ function server_common_make(port: int, handle: (input: string) => Promise, verbosity?: int): type_server_common; /** */ function server_common_start(subject: type_server_common, finish?: () => void): void; /** */ function server_common_kill(subject: type_server_common): void; } declare module lib_comm { /** * @author fenris */ class class_server_common { /** * @author fenris */ protected subject: type_server_common; /** * @author fenris */ constructor(port: int, handle: (input: string) => Promise, verbosity?: int); /** * @author fenris */ start(finish?: () => void): void; /** * @author fenris */ kill(): void; } }