<commit_before>'use strict';

var registrations = require('./registrations');

module.exports = function(redis) {

  return function(socket) {

    redis.on('updated', function(service){
      socket.to(service.id).to('listener').emit('new service', service);
    });

    redis.on('deleted', function(service){
      socket.to(service.id).to('listener').emit('delete service', service);
    });

    socket.on('add', function (data) {
      var service = registrations.create(data);
      socket.join(service.id);
      redis.update(service);
    });

    socket.on('register as listener', function(){
      socket.join('listener');
    });

    socket.on('delete', function(service) {
      redis.delete(service);
    });

  };
};<commit_msg>remove emit event 'delete service' and 'new service' to a room with service id<commit_after>'use strict';

var registrations = require('./registrations');

module.exports = function(redis) {

  return function(socket) {

    redis.on('updated', function(service){
      socket.to('listener').emit('new service', service);
    });

    redis.on('deleted', function(service){
      socket.to('listener').emit('delete service', service);
    });

    socket.on('add', function (data) {
      var service = registrations.create(data);
      socket.join(service.id);
      redis.update(service);
    });

    socket.on('register as listener', function(){
      socket.join('listener');
    });

    socket.on('delete', function(service) {
      redis.delete(service);
    });

  };
};
{'fraction_non_alphanumeric': 0.17728168089297439, 'fraction_numerical': 0.0, 'mean_word_length': 3.4823529411764707, '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': '6148192', 'n_tokens_mistral': 454, 'n_tokens_neox': 441, 'n_words': 83}