Extension of Pusher.connect() method, which registers all callbacks with
        the relevant channels, before initializing a connection.
        :return:
485443
def start(self):
        
        super(BitstampWSS, self).start()

        self.pusher = pusherclient.Pusher(self.addr, **self.__pusher_options)
        self.pusher.connection.bind('pusher:connection_established',
                                    self._register_bindings)
        self.pusher.connect()
600880
def connect(self):
        
        self.client = client.KazooClient(hosts=",".join(self.hosts))

        self.client.add_listener(self.handle_connection_change)
        self.client.start_async()
165911
function connectIfNeeded() {
      // console.log('re-establishing the connect');
      websocket = null;
      socketCreationInProcess = false;

      // The token may have expired so test for it.
      getToken(determineService())
        .then(() => {
          return processSTTSocketStart(false);
        })
        .then(() => {
          //return Promise.resolve();
          return;
        })
        .catch((err) => {
          //return Promise.resolve();
          return;
        });
    }
408400
def connect(self, *args, auto_reconnect=False, **kwargs):
        
        connection_info = {
            'auto_reconnect': auto_reconnect,
            'args': args,
            'kwargs': kwargs,
        }
        self.connect_info['connection'] = connection_info

        # confirm we have user info set
        if 'user' not in self.connect_info:
            raise Exception('`set_user_info` must be called before connecting to server.')

        # create connection and run
        connection = loop.create_connection(lambda: self,
                                            *args, **kwargs)
        asyncio.Task(connection)
377169
def connect(self, interface, event, object_path, handler):
        
        if object_path:
            def callback(connection, sender_name, object_path,
                         interface_name, signal_name, parameters):
                return handler(*unpack_variant(parameters))
        else:
            def callback(connection, sender_name, object_path,
                         interface_name, signal_name, parameters):
                return handler(object_path, *unpack_variant(parameters))
        return self.connection.signal_subscribe(
            self.bus_name,
            interface,
            event,
            object_path,
            None,
            Gio.DBusSignalFlags.NONE,
            callback,
        )
38877
def connect!
      # Keep existing connections
      return unless @backend.nil?
      @backend = train_connection.connection
      @backend.wait_until_ready

      # When the testing function `mock_instance` is used, it will set
      # this instance variable to false and handle this function call
      # after the platform data is mocked; this will allow binding
      # of mixin functions based on the mocked platform.
      mix_in_target_platform! unless @mocked_connection
    rescue Train::UserError => e
      raise ConnectionFailure.new(e, config)
    rescue Train::Error => e
      # These are typically wrapper errors for other problems,
      # so we'll prefer to use e.cause over e if available.
      raise ConnectionFailure.new(e.cause || e, config)
    end
687930
protected function registerConnectCallback()
    {
        $this->swoolePort->on('Connect', function ($server, $fd, $reactorId) {
            $this->dispatchEvent('Connect', $this->server, $this, $fd, $reactorId);
        });
    }
511928
def _prepare_connection(**kwargs):
    '''
    
    '''
    pyeapi_kwargs = __salt__['config.get']('pyeapi', {})
    pyeapi_kwargs.update(kwargs)  # merge the CLI args with the opts/pillar
    init_kwargs, fun_kwargs = __utils__['args.prepare_kwargs'](pyeapi_kwargs, PYEAPI_INIT_KWARGS)
    if 'transport' not in init_kwargs:
        init_kwargs['transport'] = 'https'
    conn = pyeapi.client.connect(**init_kwargs)
    node = pyeapi.client.Node(conn, enablepwd=init_kwargs.get('enablepwd'))
    return node, fun_kwargs
329124
def connect_signals(self):
        
        # Connect the signals inside each Work.
        for work in self:
            work.connect_signals()

        # Observe the nodes that must reach S_OK in order to call the callbacks.
        for cbk in self._callbacks:
            #cbk.enable()
            for dep in cbk.deps:
                logger.info("connecting %s \nwith sender %s, signal %s" % (str(cbk), dep.node, dep.node.S_OK))
                dispatcher.connect(self.on_dep_ok, signal=dep.node.S_OK, sender=dep.node, weak=False)
538401
def new_connection
      Connection.new(Backburner.configuration.beanstalk_url) { |conn| Backburner::Hooks.invoke_hook_events(self, :on_reconnect, conn) }
    end
1164760
def on_connect(self, connection):
        ""
        # NOTE: for python3, we can't pass bytestrings as keyword arguments
        # so we need to decode channel/pattern names back to unicode strings
        # before passing them to [p]subscribe.
        self.pending_unsubscribe_channels.clear()
        self.pending_unsubscribe_patterns.clear()
        if self.channels:
            channels = {}
            for k, v in iteritems(self.channels):
                channels[self.encoder.decode(k, force=True)] = v
            self.subscribe(**channels)
        if self.patterns:
            patterns = {}
            for k, v in iteritems(self.patterns):
                patterns[self.encoder.decode(k, force=True)] = v
            self.psubscribe(**patterns)
1270566
def connect_all(self):
        
        if self.__connected:
            return  # assert not self.__connected, "connect_all() already in \"connected\" state"
        with self.__lock:
            for signal in self.__signals:
                self.__connect_signal(signal)
            if self.__slot is not None:
                self.__sigDelayed.connect(self.__slot, Qt.QueuedConnection)
            self.__connected = True
242891
def connect(self):
    """"""
    if self._connected or self.is_alive():
      raise ConnectionExistsError("Already connected")
    # After starting the thread we wait for it to post us
    # an event signifying that connection is established. This
    # ensures that the caller only resumes when we are fully connected.
    self.start()
    with self._lock:
      self._connect_cond.wait_for(lambda: self._connected)
873138
def connect(self):
        
        ctx = Context(self.module, self.create_mediator())
        ctx.logger = self.logger
        ctx.default_factory = self.default_factory
        return ctx
1361018
def add_connection(caller_id) #:nodoc:
      connection = TCPROS::Server.new(@caller_id, @topic_name, @topic_type,
                                      :host=>@host,
                                      :latched=>@is_latched,
                                      :last_published_msg=>@last_published_msg)
      connection.start
      connection.id = "#{@topic_name}_out_#{@connection_id_number}"
      @connection_id_number += 1
      @connections.push(connection)
      return connection
    end
363559
def _connection_handler(self, event_name, data, channel_name):
        
        if channel_name in self.channels:
            self.channels[channel_name]._handle_event(event_name, data)
1243272
def connect(self, func):
        
        l = _alleged_receivers[id(self)]
        if func not in l:
            l.append(func)