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.

31 lines
758 B

  1. const io = require('socket.io-client');
  2. const rel = require('readline');
  3. const url = 'http://129.21.91.149:3000';
  4. var rl = rel.createInterface({
  5. input: process.stdin,
  6. output: process.stdout,
  7. terminal: false
  8. });
  9. var socket = io.connect(url);
  10. rl.on('line', function(line){
  11. var event = line.substring(0,line.indexOf(' '));
  12. var msg = line.substring(line.indexOf(' ') + 1);
  13. switch(event){
  14. case 'joinRoom':
  15. case 'createRoom':
  16. msg = JSON.parse(msg);
  17. case 'register':
  18. case 'submitWord':
  19. socket.emit(event, msg);
  20. }
  21. });
  22. var print = function(data){
  23. console.log(data);
  24. };
  25. socket.on('sendRooms', print);
  26. socket.on('updateRoom', print);
  27. socket.on('registerFailed', print);
  28. socket.on('joinFailed', print);