Giter Site home page Giter Site logo

pong-lobby's Introduction

Lobby + server for a game of pong (or anything really)

Sockets.io cheat sheet so far

  • socket.emit: send message to socket only.
  • socket.broadcast.emit: broadcast to all clients+channels except socket
  • io.emit: broadcast to all clients+channels
  • .to(identifier): restrict any message/broadcast to a room or client. Alias of .in(identifier)?
  • .of(identifier): restrict any message/broadcast to a namespace
  • socket.join(identifier), socket.leave(identifier): joins/leave the socket to a room. Can be done server side only. Clients join a room with their name on connection.
  • Namespace: can't be joined or leaved, is the endpoint path on which the socket connects
  • any emit has the structure ('eventType', message). message can be a string or object. (unsure - kv pairs tested). if socket.send still work, it default to 'message' eventType.
  • io.sockets.connected[socketId]: grabs a socket by id.

x1 On connection to the server, a client is registered in a lobby x2 On connection to the server, a client receives the number of players currently online x4 On game join, a client gets put at the bottom of the queque x5 On game init, both clients get notified that the game is ready x5a On game init, the server create a unique game id and add that to a game list. x6 On confirmation from both players, the server starts the game x7 On game init, the server remove the two players from the queue if present x8 On disconnection from the server, a client is removed from the lobby x9 On disconnection from the server, a client is removed from the queue if present 10 On resources available (ahah this is going to be fun), the server pair the first 2 players in the queque and goes to game init

11 On connection to server, a client old connection should be mantained if one is present 12 On game join, a client will keep is queque position if already in it. 13 On queue exit, a client is removed from the queue 14 On game join, a client can specify an custom game name instead of entering the queue

pong-lobby's People

Contributors

robota-x avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.