void listen(void handler(int worker, event))

Source

void listen(void handler(int worker, event)) {
  var i = 0;
  for (var worker in sockets) {
    var id = i;
    worker.listen((e) {
      handler(id, e);
    });
    i++;
  }
}