import { ch } from "../ch"; import { ch_net, game_protocol } from "../net/net"; export default class NetMgr { private _net: ch_net = null!; public get net(): Readonly> { if (!this._net) throw new Error("Network not initialized"); return this._net; } constructor() { this._net = ch.get_new_net(); } public init(json: boolean = false) { this._net.init(ch.wsurl, { query: `token=${chsdk.getToken()}`, json: json, }); } public connect(): Promise { return this._net.connect(); } }