npm.io
0.0.3 • Published 7 years ago

hackbox-client

Licence
MIT
Version
0.0.3
Deps
1
Size
3 kB
Vulns
0
Weekly
0
Stars
91

hackbox-client

A Jackbox inspired framework for creating party games - client component.

Usage

const hackboxClient = require("hackbox-client");

Hosting

async componentDidMount() {
  const hackbox = await hackboxClient("http://localhost:8080");
  const room = await hackbox.createRoom();
  this.setState(() => ({ room }));

  hackbox.onPlayerJoin(room => {
    this.setState(() => ({ room }));
  });
}
Joining a Room
const hackbox = await hackboxClient("http://localhost:8080");
const playerId = await hackbox.joinRoom(roomId, name);

Keywords