Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including netgame-client with all npm packages installed. Try it out:

var netgameClient = require("netgame-client")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

netgame-client v1.0.0

Performant realtime API micro-framework for interactive media


Super-simple realtime API creation for interactive web media.


npm i netgame # for server
npm i netgame-client # for browser client


The following demonstrates basic RPC.

server setup:

const {Server} = require("netgame");
const server = new Server();
server.register("add_fast", (a, b) => a + b);
server.register("add_slow", (a, b) => new Promise((res, rej) => {
    setTimeout(() => {
        res(a + b);
    }, 5000);
server.listen(1338); // listen on port 1338

client setup:

const {Client} = require("netgame-client");

window.addEventListener("load", async function() {

    let client = new Client();
    await client.connect("ws://localhost:1338");
    console.log(await client.invoke("add_fast", 2, 3)); // -> 5, immediately
    console.log(await client.invoke("add_slow", 2, 3)); // -> 5, after 5 seconds



This package was designed to facilitate online multiplayer for web browsers and the like (electron, web views, etc...). Interestingly, because it is so limited in scope, I've found it useful in several other projects; hopefully it will be helpful to you as well.

This package doesn't provide authorization or authentication because I feel it is best handled with a different package. (for now)


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free