Connects to the websocket. Returns a listening task.
761287
async def enable_events(self) -> asyncio.Task:
        """"""
        return await self._connection.ws_connect(
            on_message=self._ws_on_message, on_error=self._ws_on_error
        )
387759
def connect(self, *args, **kwargs):
        
        if self.use_ssl:
            factory = irc.connection.Factory(wrapper=ssl.wrap_socket)
        else:
            factory = irc.connection.Factory()
        self.connection.connect(server=self.server,
                                port=self.port,
                                nickname=self.nickname,
                                connect_factory=factory,
                                password=self.password,
                                username=self.username,
                                ircname=self.ircname)
850365
def run(self):
        
        self.api = self.context.get("cls")(self.context)
        self.context["inst"].append(self)  # Adapters used by strategies

        def on_ws_connect(*args, **kwargs):
            """Callback on connect hook to set is_connected_ws"""
            self.is_connected_ws = True
            self.api.on_ws_connect(*args, **kwargs)

        # Initialize websocket in a thread with channels
        if hasattr(self.api, "on_ws_connect"):
            self.thread = Process(target=self.api.connect_ws, args=(
                on_ws_connect, [
                    SockChannel(channel, res_type, self._generate_result)
                    for channel, res_type in
                    self
                    .context
                    .get("conf")
                    .get("subscriptions")
                    .items()
                ]))
            self.thread.start()
1165930
def connect(self):
                        
        self.serial = serial.Serial(port=self.port, baudrate=self.baudrate, timeout=self.timeout)
        # Start read thread
        self.alive = True 
        self.rxThread = threading.Thread(target=self._readLoop)
        self.rxThread.daemon = True
        self.rxThread.start()
788327
def connectRelay(self):
        
        self.protocol = self.connector.buildProtocol(None)
        self.connected = True
        self.protocol.makeConnection(self)
892339
def connect(self):
    
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.connect(("127.0.0.1", self._port))
    return sock
577525
def _connect(self):
        
        if not statsd:
            return

        if hasattr(statsd, 'StatsClient'):
            self.connection = statsd.StatsClient(
                host=self.host,
                port=self.port
            ).pipeline()
        else:
            # Create socket
            self.connection = statsd.Connection(
                host=self.host,
                port=self.port,
                sample_rate=1.0
            )
380476
def connect(self):
        '''
        
        '''
        self._connect()

        try:
            self._listen()
        except (KeyboardInterrupt, SystemExit):
            pass
        finally:
            self.close()
1273544
def start(self):
        
        self.running = True
        self.attempt_connection()
        receiver_thread = self.create_thread_fc(self.__receiver_loop)
        receiver_thread.name = "StompReceiver%s" % getattr(receiver_thread, "name", "Thread")
        self.notify('connecting')
1175162
def connect(self):
        """"""
        logger.debug("Opening connection to %s:%s", self.url.hostname, self.url.port)
        try:
            self.connection = httplib.HTTPConnection(self.url.hostname, self.url.port)
            self.connection.connect()
        except (httplib.HTTPException, socket.error) as e:
            raise errors.InterfaceError('Unable to connect to the specified service', e)
399976
protected function connect()
    {
        $this->socket = new Net_Notifier_Socket_Client(
            sprintf(
                'tcp://%s:%s',
                $this->host,
                $this->port
            ),
            $this->timeout / 1000
        );

        $this->connection = new Net_Notifier_WebSocket_Connection(
            $this->socket
        );

        $this->connection->startHandshake(
            $this->host,
            $this->port,
            $this->resource,
            array(Net_Notifier_WebSocket::PROTOCOL)
        );

        // read handshake response
        $state = $this->connection->getState();
        while ($state < Net_Notifier_WebSocket_Connection::STATE_OPEN) {

            $read = array($this->socket->getRawSocket());

            $result = stream_select(
                $read,
                $write = null,
                $except = null,
                null
            );

            if ($result === 1) {
                $this->connection->read(self::READ_BUFFER_LENGTH);
            }

            $state = $this->connection->getState();
        }
    }
405915
def connect(self):
        

        # Make sure we're in client mode
        if self.mode and self.mode != 'client':
            raise ValueError("%s is not in client mode" %
                             self.__class__.__name__)
        self.mode = 'client'

        # If we're connected, nothing to do
        if self.conn:
            return

        # OK, attempt the connection
        fd = socket.create_connection((self.host, self.port))

        # Initialize the connection object
        self.conn = self.connection_class(fd)

        # Authenticate
        try:
            self.conn.send('AUTH', self.authkey)
            cmd, payload = self.conn.recv()
            if cmd != 'OK':
                LOG.error("Failed to authenticate to %s port %s: %s" %
                          (self.host, self.port, payload[0]))
                self.close()
        except Exception:
            exc_type, exc_value, exc_tb = sys.exc_info()

            # Log the error
            if exc_type == ValueError:
                LOG.error("Received bogus response from server: %s" %
                          str(exc_value))
            elif exc_type == ConnectionClosed:
                LOG.error("%s while authenticating to server" %
                          str(exc_value))
            else:
                LOG.exception("Failed to authenticate to server")

            # Close the connection
            self.close()

            # Re-raise the exception
            raise exc_type, exc_value, exc_tb
499203
def connect(self):
        
        self.client = redis.Redis(
            host=self.host, port=self.port, password=self.password)
930753
public synchronized void connect() {
        if (state != State.NONE) {
            eventHandler.onError(new WebSocketException("connect() already called"));
            close();
            return;
        }
        getIntializer().setName(getInnerThread(), THREAD_BASE_NAME + "Reader-" + clientId);
        state = State.CONNECTING;
        getInnerThread().start();
    }
1000952
def connect_websocket(self, **kwargs) -> 'WebSocketContextManager':
        '''
        
        '''
        assert isinstance(self.session, AsyncSession), \
               'Cannot use websockets with sessions in the synchronous mode'
        assert self.method == 'GET', 'Invalid websocket method'
        self.date = datetime.now(tzutc())
        self.headers['Date'] = self.date.isoformat()
        # websocket is always a "binary" stream.
        self.content_type = 'application/octet-stream'
        full_url = self._build_url()
        self._sign(full_url.relative())
        ws_ctx = self.session.aiohttp_session.ws_connect(
            str(full_url),
            autoping=True, heartbeat=30.0,
            headers=self.headers)
        return WebSocketContextManager(self.session, ws_ctx, **kwargs)
362146
public void connect() throws IOException, DeploymentException {
        WebSocketContainer container = ContainerProvider.getWebSocketContainer();
        container.connectToServer(this, wssUri);
        log.debug("client connected to the server: {}", wssUri);
    }
349257
public void connect() {

        readyState = ReadyState.CONNECTING;

        try {
            if (webSocketHandler == null) {
                webSocketHandler = new WebSocketHandlerAdapter();
            }

            container.connectToServer(new SimpleWebSocketClientEndpoint(), ClientEndpointConfig.Builder.create().build(), websocketURI);
        } catch (Exception e) {

            readyState = ReadyState.CLOSED;
            // throws DeploymentException, IOException
            throw new RuntimeException("could not establish connection");

        }
    }