Skip to content

4lbertoC/quizjs

Repository files navigation

NPM version Build Status Dependency Status

QuizJs

A web-based platform for live quizzes.

It consists of a master client, one or more player clients and a server to handle the communication between them.

Game Mechanics

  • The master resets the game state and asks a question.
  • The players who want to answer subscribe to the question (like if they pressed a buzzer button).
  • The first player who subscribes can give the answer, while the other players are added to a queue.
  • If the answer is wrong, the master skips to the next player in the queue until either the answer is right or the queue is empty.

Install

$ npm install --save quizjs

Usage

The package contains a basic socket.io server that can be run with:

$ node implementations/socket.io/quizjs-socket.io.js

The socket.io player and master clients are built into the dist directory by simply running:

$ grunt

There are no UI components included included in this package.

Here you can find a simple player implementation.

Server API

QuizJsServer#registerPlayer()

Registers a new player to the QuizJs server and returns its ID.

QuizJsServer#subscribe(playerId)

Subscribes a player to the current question.

QuizJsServer#nextSubscriber()

Passes the turn to the next subscriber.

QuizJsServer#resetState()

Empties the current subscriber queue and allows all the players to subscribe for a new question.

The QuizJs server also implements the following methods of events.EventEmitter: on, once, removeListener, removeAllListeners.

Server Events

quizjs-register-player

Sent when a player is registered to the QuizJs server.

quizjs-state-reset

Sent when the QuizJs server state is reset.

quizjs-state-update

Sent when the QuizJs server state is updated.

License

MIT © Alberto Congiu

About

A web-based platform for live quiz shows

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published