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.

46 lines
1.0 KiB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Hello world</title>
  5. </head>
  6. <script src = "../../socket.io/socket.io.js"></script>
  7. <script>
  8. var socket = io();
  9. socket.emit('register', 'jeff');
  10. var join = function(name)
  11. {
  12. var obj = new Object();
  13. obj.roomName = name;
  14. obj.password = '';
  15. socket.emit('joinRoom', obj);
  16. }
  17. socket.on('sendRooms', function(data)
  18. {
  19. console.log("got rooms");
  20. console.log(data);
  21. //document.write(data);
  22. data.rooms.forEach(function(r)
  23. {
  24. document.write("<input type=\"submit\" value=\"Join Room" + r.name + "\" onclick=\"join(\"" + r.name + "\")\">");
  25. document.write(r.name)
  26. document.write("<br />");
  27. });
  28. var tt = new Object();
  29. tt.roomName = "den";
  30. tt.password = "pp";
  31. socket.emit('createRoom', tt);
  32. });
  33. socket.on('roomUpdate', function(data)
  34. {
  35. console.log("good");
  36. console.log(data);
  37. });
  38. </script>
  39. <body>Hello world</body>
  40. </html>