<commit_before>//TODO: Make sure the ws connection is open before trying to send something

module.exports = {

  /* When the player wants to create a new room */
  createRoom(ws, {roomName, playerName}){
    var msg = {
      name: 'createRoom',
      data: {
        room:{
          name: roomName
        },
        player: {
         name: playerName
        }
      }
    };
    msg = JSON.stringify(msg);
    ws.send(msg);
  },

  /* When the player needs the list of rooms */
  getRooms(ws){
    var msg = {
      name: 'getRooms'
    };
    msg = JSON.stringify(msg);
    ws.send(msg);
  },

  /* When the player wants to join a room */
  joinRoom(ws, {id, name}){
    var msg = {
      name: 'joinRoom',
      data: {id, name}
    };
    msg = JSON.stringify(msg);
    ws.send(msg);
  },

  /* Pings at 15 second intervals to keep connection alive */
  keepAlive(ws){
    var msg = {
      name: 'ka'
    };
    msg = JSON.stringify(msg);
    ws.send(msg);
  },
  /* When the player wants to start a new round */
  newRound(ws, id){
    var msg = {
      name: 'newRound',
      data: {id}
    };
    msg = JSON.stringify(msg);
    ws.send(msg);
  },

  /* When the player primes or locks in their score */
  scoreChange(ws, {score, status}){
    var msg = {
      name: 'scoreChange',
      data: {
        score,
        status
      }
    };
    msg = JSON.stringify(msg);
    ws.send(msg);<commit_msg>Fixed spacing<commit_after>//TODO: Make sure the ws connection is open before trying to send something

module.exports = {

  /* When the player wants to create a new room */
  createRoom(ws, {roomName, playerName}){
    var msg = {
      name: 'createRoom',
      data: {
        room:{
          name: roomName
        },
        player: {
         name: playerName
        }
      }
    };
    msg = JSON.stringify(msg);
    ws.send(msg);
  },

  /* When the player needs the list of rooms */
  getRooms(ws){
    var msg = {
      name: 'getRooms'
    };
    msg = JSON.stringify(msg);
    ws.send(msg);
  },

  /* When the player wants to join a room */
  joinRoom(ws, {id, name}){
    var msg = {
      name: 'joinRoom',
      data: {id, name}
    };
    msg = JSON.stringify(msg);
    ws.send(msg);
  },

  /* Pings at 15 second intervals to keep connection alive */
  keepAlive(ws){
    var msg = {
      name: 'ka'
    };
    msg = JSON.stringify(msg);
    ws.send(msg);
  },
  
  /* When the player wants to start a new round */
  newRound(ws, id){
    var msg = {
      name: 'newRound',
      data: {id}
    };
    msg = JSON.stringify(msg);
    ws.send(msg);
  },

  /* When the player primes or locks in their score */
  scoreChange(ws, {score, status}){
    var msg = {
      name: 'scoreChange',
      data: {
        score,
        status
      }
    };
    msg = JSON.stringify(msg);
    ws.send(msg);
{'fraction_non_alphanumeric': 0.13907518531591953, 'fraction_numerical': 0.0014119308153900459, 'mean_word_length': 1.8947906026557713, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2045403', 'n_tokens_mistral': 965, 'n_tokens_neox': 933, 'n_words': 272}