"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ModLoaderRPC = void 0;
const http_1 = __importDefault(require("http"));
const EventHandler_1 = require("modloader64_api/EventHandler");
const RPC_1 = require("modloader64_api/RPC");
class ModLoaderRPC {
    server;
    setup() {
        try {
            this.server = http_1.default.createServer(function (req, res) {
                res.writeHead(200, { 'Content-Type': 'application/json' });
                let resp = new RPC_1.RPC_Receieve_Event(req);
                EventHandler_1.bus.emit("RPC:ON_RECEIVE" /* RPCEvents.ON_RECEIVE */, resp);
                res.write(JSON.stringify(resp.response));
                res.end();
            }).listen(6500);
            this.server.on('error', (err) => {
            });
        }
        catch (err) {
        }
    }
}
exports.ModLoaderRPC = ModLoaderRPC;
//# sourceMappingURL=ModLoaderRPC.js.map