Skip to content

Node.js back-end with a React and Redux front-end to handle user joining one of multiple instances over WebSockets.

License

Notifications You must be signed in to change notification settings

nyanofthemoon/WebSocket-Client-Instance-Manager

Repository files navigation

WebSocket Client Instance Manager

Kind of like a mutant in-between a boilerplate and a framework for building multi-user WebSocket applications over several client instances.

Installation

Development

  • npm install
  • npm run dev runs the development environment using webpack-dev-server + hot reload

Deployment

  • npm run dist builds the production distribution package for JS, CSS and other assets
  • npm run start start-up script

Requests And Responses

Query User

Request
socket.emit('query', data)
data = {
  "type": "user"
}
Response
socket.on('query', callback)
{
  "type": "user",
  "data": {
    "name": "Nyan"
  }
}

Query Instance

Request
socket.emit('query', data)
data = {
  "type": "instance",
  "id"  : "QWERTY"
}
Response
socket.on('query', callback)
{
  "type": "instance",
  "data": {
    "id"    : "QWERTY",
    "status": "waiting",
    "users" : []
  }
}

Join Instance

Request
socket.emit('join', data)
data = {
  "id": "QWERTY"
}
Response
socket.on('query', data)

Speak Instance

Request
socket.emit('speak', data)
data = {
  "message": "Hello!"
}
Response
socket.on('speak', callback)
{
  "name"  : "Nyan",
  "message: "Hello!"
}

Leave Instance

Request
socket.emit('leave', data)
data: {
  "id": "QWERTY"
}
Response
socket.on('query', data)

About

Node.js back-end with a React and Redux front-end to handle user joining one of multiple instances over WebSockets.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published