## RabbitHub This class represents a hub for RabbitMQ.
484010
function(options) {
    
    // Call super class.
    EventEmitter.call(this);
    
    // Set options and load defaults if needed.
    this.options = options || {};
    
    this.host = this.options.host || 'localhost';
    this.port = this.options.port || 5672;
    this.protocol = this.options.protocol || 'amqp';
    this.login = this.options.login;
    this.password = this.options.password;
    this.vhost = this.options.vhost;
    this.task = this.options.task;

    this.url = this.protocol + '://';
    if (this.login && this.password) {
        this.url += this.login + ':' + this.password + '@';
    }
    this.url += this.host;
    if (this.port) {
        this.url += ':' + this.port;
    }
    if (this.vhost) {
        this.url += this.vhost;
    }

}
814805
def on_start(self):
        
        LOGGER.debug("rabbitmq.Service.on_start")
        self.connection = pika.BlockingConnection(self.parameters)
        self.channel = self.connection.channel()
        self.channel.queue_declare(queue=self.serviceQ, auto_delete=True)
        self.channel.basic_consume(self.on_request, self.serviceQ)
        self.service = threading.Thread(target=self.run, name=self.service_name)
        self.service.start()
        self.is_started = True
1201010
public void hubHeartbeat(UpdateServerHeartbeat updateServer, 
                           UpdateRackHeartbeat updateRack,
                           UpdatePodSystem updatePod,
                           long sourceTime)
  {
    RackHeartbeat rack = getCluster().findRack(updateRack.getId());
    
    
    if (rack == null) {
      rack = getRack();
    }
    
    updateRack(updateRack);
    
    updateServerStart(updateServer);
    
    // XXX: _podService.onUpdateFromPeer(updatePod);
    
    // rack.update();
    
    updateTargetServers();

    PodHeartbeatService podHeartbeat = getPodHeartbeat();
    
    if (podHeartbeat != null && updatePod != null) {
      podHeartbeat.updatePodSystem(updatePod);
    }
    
    _joinState = _joinState.onHubHeartbeat(this);
    
    // updateHubHeartbeat();
    updateHeartbeats();
  }
1169947
function CollabSocket(hubUrl, sessionId) {
        var self = this;
		
		this.socket = io.connect( hubUrl+ "?sessionId=" +sessionId, { path: "/socket.io/" });

        this.socket.on('connect', function() {
            self.dispatchEvent({
                type: 'ready'
            });
        });
        
        this.socket.on('disconnect', function() {
            self.dispatchEvent({
                type: 'close'
            });
        });
        
        this.socket.on('error', function(e) {
           self.dispatchEvent({
                type: 'error',
                error: e
            });
            console.error(e);
        });

        this.socket.on('message', function(data) {
            self.dispatchEvent({
                type: 'message',
                data: data
            });
            if (DEBUG) {
                var msgObj = JSON.parse(data);
                console.log('CollabSocket In: ' + msgObj.type, msgObj);
            }
        });

        EventTarget.attach(this);
	}
341429
function configureConnection(connection) {
        // Set the common hub
        abp.signalr.hubs.common = connection;

        // Reconnect if hub disconnects
        connection.onclose(function (e) {
            if (e) {
                abp.log.debug('Connection closed with error: ' + e);
            }
            else {
                abp.log.debug('Disconnected');
            }

            if (!abp.signalr.autoConnect) {
                return;
            }

            setTimeout(function () {
                if ($.connection.hub.state === $.signalR.connectionState.disconnected) {
                    $.connection.hub.start();
                }
            }, 5000);
        });

        // Register to get notifications
        connection.on('getNotification', function (notification) {
            abp.event.trigger('abp.notifications.received', notification);
        });
    }
506996
def main():
    

    logging.basicConfig(level=logging.INFO)

    example_sync_client(SyncAPIClient())
    example_async_client(AsyncAPIClient())

    io_loop = ioloop.IOLoop.current()
    io_loop.start()
1216469
public static String getHub() throws InvalidHubException {
        String hub = getProgramProperty(HUB);
        if (hub == null || "".equals(hub)) {
            throw new InvalidHubException("Hub isn't set");
        }
        return hub;
    }
589678
function main() {
  var server = new grpc.Server();
  server.addService(hello_proto.Greeter.service, {sayHello: sayHello});
  server.bind('0.0.0.0:50051', grpc.ServerCredentials.createInsecure());
  server.start();
}
902247
function () {
    const chanInstance = this.mapper.getObject(this.modelElement.hub.path());
    const compInstance = this.mapper.getObject(this.modelElement.port.eContainer().path());

    if (chanInstance) {
      if (compInstance) {
        // if compInstance is found then it means that the port is on this node
        if (this.modelElement.port.getRefInParent() === 'provided') {
          // binding related port is an 'in' port type
          const input = compInstance.inputs[this.modelElement.port.path()];
          chanInstance.addInputPort(input);
          this.log.debug(input.path + ' <-> ' + chanInstance.path);
        } else {
          // binding related port is an 'out' port type
          const output = compInstance.outputs[this.modelElement.port.path()];
          output.addChannel(chanInstance);
          this.log.debug(output.path + ' <-> ' + chanInstance.path);
        }

        return Promise.resolve();

      } else {
        if (this.modelElement.port.getRefInParent() === 'provided') {
          // only add input port
          chanInstance.addInputPort(new Input(this.modelElement.port.eContainer(), this.modelElement.port, true));
          this.log.debug('create remote input: ' + this.modelElement.port.path());
          this.log.debug(this.modelElement.port.path() + ' <-> ' + chanInstance.path);
        }
        return Promise.resolve();
      }
    } else {
      return Promise.reject(new Error(this.toString() + ' error: unable to find channel ' + this.modelElement.hub.name + ' instance on platform.'));
    }
  }
1365543
void hubHeartbeat(UpdateServerHeartbeat updateServer,
                    UpdateRackHeartbeat updateRack,
                    UpdatePodSystem updatePod,
                    long sequence)
  {
    if (startUpdate(updateRack, updatePod)) {
      getHeartbeat().hubHeartbeat(updateServer, updateRack, updatePod, sequence);
    }
  }
130972
def create(self):
        

        super().create()
        log.info('Ethernet hub "{name}" [{id}] has been created'.format(name=self._name, id=self._id))
543478
function NetworkServer(server) {
  this.server = server;
  function connection(socket) {
    server.connection(socket, this);
  }
  this.on('connection', connection);
}
853574
protected function createWorkerReplySocket()
    {
        /** @var Context|\ZMQContext $workerReplyContext */
        $workerReplyContext = new Context($this->loop);
        $this->workerReplySocket = $workerReplyContext->getSocket(\ZMQ::SOCKET_REP);
        $this->workerReplySocket->bind($this->config['sockets']['worker_reply']);
        $this->workerReplySocket->on('message', [$this, 'onWorkerReplyMessage']);
    }
1025537
function MQTTMsgBusClientNode(config) {
        //console.log("MQTTMsgBusClientNode(): config = ", config)

        RED.nodes.createNode(this, config)

        this.domain     = "domain"
        this.platformId = "nodered"

        this.classType  = ClassType.ClassTypeControllerSvc
        this.nodename   = config.nodename
        this.broker     = config.broker
        this.brokerConn = RED.nodes.getNode(this.broker)

        var willMsg = statusMessage(this, MsgbusStatusDisconnected, 0)

        this.brokerConn.willTopic = willMsg.topic 
        this.brokerConn.options.will = {
            topic:   this.brokerConn.willTopic,
            payload: willMsg.msg,
            qos:     2,
            retain:  true
        }

        var birthMsg = statusMessage(this, MsgbusStatusOnline, 0)

        this.brokerConn.birthTopic = birthMsg.topic 
        this.brokerConn.birthMessage = {
            topic:   this.brokerConn.birthTopic,
            payload: birthMsg.msg,
            qos:     2,
            retain:  true
        }

        var node = this

        if (this.brokerConn) {
            //console.log("MQTTMsgBusClientNode(): node.brokerConn = ", node.brokerConn)
            node.brokerConn.register(node)
        } else {
            node.log(RED._("msgbus.errors.missing-config"))
        }

        this.on('close', function(done) {
            node.brokerConn.deregister(node, done)
        })
    }
749496
public HubConnection build() {
        return new HubConnection(url, transport, skipNegotiate, httpClient, accessTokenProvider, handshakeResponseTimeout, headers);
    }
636253
private GridHubConfiguration getHubConfiguration() throws Exception {
    String hubApi =
        "http://" + registrationRequest.getConfiguration().getHubHost() + ":"
        + registrationRequest.getConfiguration().getHubPort() + "/grid/api/hub";

    URL api = new URL(hubApi);
    HttpClient client = httpClientFactory.createClient(api);
    String url = api.toExternalForm();
    HttpRequest request = new HttpRequest(GET, url);

    HttpResponse response = client.execute(request);
    try (Reader reader = new StringReader(response.getContentString());
         JsonInput jsonInput = new Json().newInput(reader)) {
      return GridHubConfiguration.loadFromJSON(jsonInput);
    }
  }
137923
private function setupServer()
    {
        $this->setupApp();

        /** @var $loop \React\EventLoop\LoopInterface */

        $this->loop = \React\EventLoop\Factory::create();
        
        $this->socket = new \React\Socket\Server($this->loop);

        if ($this->host)
        {
            $this->socket->listen($this->port, $this->host);
        }else{
            $this->socket->listen($this->port);
        }

        $this->setupPeriodicServices();

        $this->server = new \Ratchet\Server\IoServer($this->app, $this->socket, $this->loop);
    }