Skip to content

bagabont/hotkey-ninja

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hotkey Ninja

Configurations

Environment Variables

MONGO_USER

Sets the username of the connection string

MONGO_PASS

sets the password of the connection string

Web Sockets Communication Protocol

Namespace

Default namespace is '/socket'

Server

'load' event

Finds all connected client sockets to this room and emits a 'loaded' event. If the game is full, then a 'full' event is emitted.

'join' event

Finds the requested game room and joins it. When 2 players have joined the room it requests the appropriate application shortcuts list. If such list is found, and both players are still presents, server emits a 'start' game event and then the first 'query' event is also emitted. If the game is full, then a 'full' event is emitted.

'answer' event

Checks if the shortcut combination in the answer is correct and emits a 'progress' event. If the progress of one of the players reaches the length of the shortcuts list, the game ends. Winner is the player with highest score.

Example:

{
    "answer": "ctrl+s",
    "user": "Player"
}

'disconnect' event

Notifies the other person in the game room that his partner has left

##Client

'loaded' event

Receives game setup.

Example:

{
	"players": 1,
    "user": "Player",
    "id": "id"
}

'start' event

Occurs when game is started.

Example:

{
    "id": "id",
    "users": ["Player", "Opponent"],
    "total": "11"
}

'query' event

Occurs when a new query is received.

Example:

{
    "query": "Select all text."
}

'progress' event

Reports progress change of a player to all players in the current game room.

Example:

{
    "id": "id",
    "score": "3",
    "user": "Opponent"
}

'game over' event

Indicates end of game and the winner.

Example:

{
    "winner": "Player"
}

'leave' event

If a player leaves the game room this event will occur.

Example:

{
    "room": "id",
    "user": "Player"
}

'full' event

Indicates that the game is full, and no more players can join it.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published