angular.module("allcount").directive("lcSocketListen", [function () {
    return {
        restrict: 'A',
        scope: false,
        link: function (scope, element, attrs) {
            attrs.$observe('lcSocketListen', function (entityCrudId) {
                if (!entityCrudId) {
                    return;
                }
                var socket = io();
                socket.emit('listen-entity-change', entityCrudId);
                socket.on('entity-change', function (changedEntityCrudId) {
                    if (changedEntityCrudId === entityCrudId) {
                        scope.$eval(attrs.onSocketChange);
                    }
                })
            })
        }
    }
}]);

@@ -1,8 +1,89 @@
+angular.module(%22allcount%22).factory('socket', function () %7B%0A    return io();%0A%7D);%0A%0A
 angular.
@@ -130,16 +130,26 @@
 sten%22, %5B
+%22socket%22, 
 function
@@ -142,32 +142,38 @@
 ket%22, function (
+socket
 ) %7B%0A    return %7B
@@ -425,43 +425,8 @@
   %7D%0A
-                var socket = io();%0A
     

Allow to override socket factory