not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.3 KiB

  1. var app = require('express')();
  2. var http = require('http').Server(app);
  3. var io = require('socket.io')(http);
  4. const port = 3000;
  5. var room = function(capacityP, roomN)
  6. {
  7. //max capacity of room -- default is 4 for now
  8. this.capacity = capacityP;
  9. //name of the room
  10. this.roomName = roomN;
  11. //list of words used in the game
  12. this.words = [];
  13. //list of clients sockets -- so we can push requests to them
  14. this.users = [];
  15. //increments when rounds pass
  16. this.currentRoom = 0;
  17. /**
  18. * adds a user to a room
  19. * @param socket
  20. */
  21. this.addUser = function(socket)
  22. {
  23. }
  24. }
  25. var player = function(name)
  26. {
  27. //name of the user
  28. this.name = name;
  29. //score of the player
  30. this.score = 0;
  31. //reference to the room -- might not need this
  32. this.room = null;
  33. //
  34. this.sumbission = null;
  35. }
  36. //list of all the rooms
  37. var rooms = [];
  38. //Whenever someone connects this gets executed
  39. io.on('connection', function(socket)
  40. {
  41. console.log('A user connected');
  42. socket.on('clientEvent', function(data) {
  43. console.log(data);
  44. });
  45. //Whenever someone disconnects this piece of code executed
  46. socket.on('disconnect', function () {
  47. console.log('A user disconnected');
  48. });
  49. });
  50. http.listen(port, function() {
  51. console.log('listening on *:3000');
  52. });