(options: {
output_container_elem: JQuery,
input_container_elem: JQuery,
backend_address: string,
app_name: string,
protocol: string, // 'http', 'ws', 'auto'
runtime_config: { [name: string]: any }
})
| 56 | |
| 57 | |
| 58 | function startWebIOClient(options: { |
| 59 | output_container_elem: JQuery, |
| 60 | input_container_elem: JQuery, |
| 61 | backend_address: string, |
| 62 | app_name: string, |
| 63 | protocol: string, // 'http', 'ws', 'auto' |
| 64 | runtime_config: { [name: string]: any } |
| 65 | }) { |
| 66 | for (let key in options.runtime_config) { |
| 67 | // @ts-ignore |
| 68 | appConfig[key] = options.runtime_config[key]; |
| 69 | } |
| 70 | const backend_addr = backend_absaddr(options.backend_address); |
| 71 | |
| 72 | let start_session = (is_http: boolean) => { |
| 73 | let session; |
| 74 | if (is_http) |
| 75 | session = new HttpSession(backend_addr, options.app_name, appConfig.httpPullInterval); |
| 76 | else |
| 77 | session = new WebSocketSession(backend_addr, options.app_name); |
| 78 | set_up_session(session, options.output_container_elem, options.input_container_elem); |
| 79 | session.start_session(appConfig.debug); |
| 80 | }; |
| 81 | if (options.protocol == 'auto') |
| 82 | is_http_backend(backend_addr).then(start_session); |
| 83 | else |
| 84 | start_session(options.protocol == 'http') |
| 85 | } |
| 86 | |
| 87 | |
| 88 | // @ts-ignore |
nothing calls this directly
no test coverage detected
searching dependent graphs…