module main

import core
import cryptography

fn main() {
	core.initialize()
    logs.info('main:main:main', 'Called initiliazer func!')

	go fn(ch chan WsResult) {
        conn := core.establish_ws_conn() or {
            ch <- WsResult{err: 'Could not establish WS: $err'}
            return
        }
        ch <- WsResult{conn: conn}
    }(ch)

    logs.info('main:main:main', 'Connecting to \'$configuration.websocket\'.')

    res := <-ch

    if res.err != none {
        logs.error('main:main:main', res.err or { 'Unknown error' })
    } else {
        logs.info('main:main:main', 'Successfully connected to WS on \'$configuration.websocket\'.')
    }
}