<commit_before>// Constructor
function ServerClient() {
  ServerClient.app = require('express')();
  ServerClient.http = require('http').Server(ServerClient.app);
  ServerClient.io = require('socket.io')(ServerClient.http);
  ServerClient.clientEvent = require('events');
}

// class methods
ServerClient.prototype.initServer = function() {

    ServerClient.app.get('/client',function(req,res){
      res.sendFile(__dirname + '/indexClient.html');
    });

    ServerClient.io.on('connection', function(socket){
      console.log('connection from client');
      socket.on('chat message', function(msg){
        console.log('message  from client! ');
        console.log(msg);
        ServerClient.io.emit('chat message', msg);
      });
    });

    ServerClient.http.listen(3001, function(){
      console.log('listening on *:3001');
    });
};

// export the class
module.exports = new ServerClient();<commit_msg>Ajout de la récupèration des id de sockets<commit_after>// Constructor
function ServerClient() {
  ServerClient.app = require('express')();
  ServerClient.http = require('http').Server(ServerClient.app);
  ServerClient.io = require('socket.io')(ServerClient.http);
  ServerClient.activeSocket = [];
}

// class methods
ServerClient.prototype.initServer = function() {

    ServerClient.app.get('/client',function(req,res){
      res.sendFile(__dirname + '/indexClient.html');
    });

    ServerClient.io.on('connection', function(socket){
      console.log('connection from client' + socket.id);

      ServerClient.io.to(socket.id).emit('chat message', socket.id);

      ServerClient.activeSocket.push(socket.id);

      socket.on('chat message', function(msg){
        console.log('message  from ' + socket.id + ' ' + msg);
        ServerClient.io.emit('chat message', msg);
      });

      socket.on('disconnect', function(){
        console.log('disconnect from ' + this.id);
      });
    });

    ServerClient.http.listen(3001, function(){
      console.log('listening on *:3001');
    });
};

// export the class
module.exports = new ServerClient();
{'fraction_non_alphanumeric': 0.16618497109826588, 'fraction_numerical': 0.007707129094412331, 'mean_word_length': 3.688487584650113, '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': '1422533', 'n_tokens_mistral': 617, 'n_tokens_neox': 596, 'n_words': 105}