~starkingdoms/starkingdoms

e310e317e41c6cf980d5538792a5f91f1c5e2152 — core 2 years ago 6680ca9
rename gateway to client hub
2 files changed, 9 insertions(+), 9 deletions(-)

R starkingdoms-client/src/{gateway => hub}.ts
M starkingdoms-client/src/main.ts
R starkingdoms-client/src/gateway.ts => starkingdoms-client/src/hub.ts +6 -6
@@ 1,20 1,20 @@
import createDebug from "debug";
import {Packet, PacketType} from "./protocol.ts";

const logger = createDebug("gateway");
const logger = createDebug("hub");

export interface GatewayClient {
export interface ClientHub {
    socket: WebSocket;
}

export async function gateway_connect(url: string, username: string) {
    logger("connecting to gateway socket at " + url)
export async function hub_connect(url: string, username: string) {
    logger("connecting to client hub at " + url)

    let ws = await _websocket_connect(url);

    logger("connected to gateway, sending username and auth details");
    logger("connected to client hub, sending username and auth details");

    let client: GatewayClient = {
    let client: ClientHub = {
        socket: ws
    };


M starkingdoms-client/src/main.ts => starkingdoms-client/src/main.ts +3 -3
@@ 1,5 1,5 @@
import createDebug from "debug";
import {gateway_connect, GatewayClient} from "./gateway.ts";
import {hub_connect, ClientHub} from "./hub.ts";
import {ConfigServer, loadConfig} from "./config.ts";
import "./css/style.css";
import "./css/themes/catppuccin-mocha/colors.css";


@@ 10,7 10,7 @@ const logger = createDebug("main");
logger(`Hello, world! StarKingdoms ${APP_VERSION} (${COMMIT_HASH}) at your service`);

export interface GlobalData {
    client: GatewayClient | null
    client: ClientHub | null
}

export const global: GlobalData = {


@@ 100,7 100,7 @@ document.getElementById("join-fm")!.addEventListener("submit", async (e) => {

        logger(`connecting to ${server.clientHubUrl} as ${username} with auth = none`);

        global.client = await gateway_connect(server.clientHubUrl, username);
        global.client = await hub_connect(server.clientHubUrl, username);
    } catch (e) {
        setStatus("Connection failed!");
        console.error(e);