Skip to content

Qwiri/gobby-ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gobby-TS

Gobby wrapper for TypeScript.

Example

import { Gobby, Message, ö } from "../src";

(async () => {
    const gobby = new Gobby("ws://localhost:8080");

    try {
        await gobby.connect();
    } catch (e) {
        console.error(e);
        return;
    }

    // join lobby
    const user = await gobby.join("foo");
    if (!user) {
        console.error("[Gobby] failed to join lobby");
        return;
    }
    console.log("[Gobby] joined lobby as:", user);

    gobby.handle("VERSION", (msg: Message) => {
        console.log("[Gobby] received backend version:", msg.args);

        // respond with client version
        if (msg.reply) {
            gobby.send(ö("VERSION", "1.0.0"), msg);
        }
    });
})();

About

TypeScript Wrapper for Gobby

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published