<commit_before>var socketIO = require('socket.io');

var socketObject = {
	socketServer: function (server) {
		var io = socketIO.listen(server);

		io.sockets.on('connection', function(socket) {
		  console.log('connected');

		  socket.on('newWorkspace', function (hashCode) {
				var nsp = io.of('/'+hashCode);
				socket.emit('workspaceCreated');
				nsp.on('connection', function(socket) {
					console.log('connected to', hashCode);
				});
			});

          socket.on('fileUpload', function(filename){
            console.log(filename);
          });
		});
	},
}

module.exports = socketObject;<commit_msg>Adds beginning scaffolding for room-based sockets<commit_after>var socketIO = require('socket.io');

var socketObject = {
  socketServer: function (server) {
    var io = socketIO.listen(server);

    io.sockets.on('connection', function(socket) {
      console.log('connected');

      socket.on('adduser', function(username, hashcode){
        // TODO: Perform some sort of validation to ensure that workspace exists
        // Store username in socket session for this client
        socket.username = username;
        // Store room name in socket session for this client
        socket.workspace = hashcode;
        // Send client to workspace at hashcode
        socket.join(hashcode);
        // TODO: What do we need to emit to let the other users know to add a new user?
      });

      socket.on('split', function(splitOperation){
        // TODO: Grab the correct workspace using socket.workspace
        // TODO: Update the state
        // TODO: Emit event using 'io.sockets.in(socket.workspace).emit('applySplit', newRow)'
      });

      socket.on('flag', function(flagOperation){
        // TODO: Grab the correct workspace using socket.workspace
        // TODO: Update the workspace object from mongo
        // TODO: Emit event with updated block flags using 'io.sockets.in(socket.workspace).emit('applyFlag', data)''
      });

      socket.on('move', function(moveOperation){
        // TODO: Same pattern as above operations
      });

      // TODO: What other operations do we need to support? Adding a row? Does that happen here?
    });
  },
}

module.exports = socketObject;
{'fraction_non_alphanumeric': 0.1237020316027088, 'fraction_numerical': 0.0, 'mean_word_length': 2.887719298245614, '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': '2034069', 'n_tokens_mistral': 629, 'n_tokens_neox': 591, 'n_words': 180}