async def connect(self, url, headers={}, transports=None,
                      namespaces=None, socketio_path='socket.io'):
        """Connect to a Socket.IO server.

        :param url: The URL of the Socket.IO server. It can include custom
                    query string parameters if required by the server.
        :param headers: A dictionary with custom headers to send with the
                        connection request.
        :param transports: The list of allowed transports. Valid transports
                           are ``'polling'`` and ``'websocket'``. If not
                           given, the polling transport is connected first,
                           then an upgrade to websocket is attempted.
        :param namespaces: The list of custom namespaces to connect, in
                           addition to the default namespace. If not given,
                           the namespace list is obtained from the registered
                           event handlers.
        :param socketio_path: The endpoint where the Socket.IO server is
                              installed. The default value is appropriate for
                              most cases.

        Note: this method is a coroutine.

        Example usage::

            sio = socketio.Client()
            sio.connect('http://localhost:5000')
        """
        self.connection_url = url
        self.connection_headers = headers
        self.connection_transports = transports
        self.connection_namespaces = namespaces
        self.socketio_path = socketio_path

        if namespaces is None:
            namespaces = set(self.handlers.keys()).union(
                set(self.namespace_handlers.keys()))
        elif isinstance(namespaces, six.string_types):
            namespaces = [namespaces]
            self.connection_namespaces = namespaces
        self.namespaces = [n for n in namespaces if n != '/']
        try:
            await self.eio.connect(url, headers=headers,
                                   transports=transports,
                                   engineio_path=socketio_path)
        except engineio.exceptions.ConnectionError as exc:
            six.raise_from(exceptions.ConnectionError(exc.args[0]), None)
async def connect ( self , url , headers = { } , transports = None , namespaces = None , socketio_path = 'socket.io' ) : self . connection_url = url self . connection_headers = headers self . connection_transports = transports self . connection_namespaces = namespaces self . socketio_path = socketio_path if namespaces is None : namespaces = set ( self . handlers . keys ( ) ) . union ( set ( self . namespace_handlers . keys ( ) ) ) elif isinstance ( namespaces , six . string_types ) : namespaces = [ namespaces ] self . connection_namespaces = namespaces self . namespaces = [ n for n in namespaces if n != '/' ] try : await self . eio . connect ( url , headers = headers , transports = transports , engineio_path = socketio_path ) except engineio . exceptions . ConnectionError as exc : six . raise_from ( exceptions . ConnectionError ( exc . args [ 0 ] ) , None )
Connect to a Socket.IO server.

        :param url: The URL of the Socket.IO server. It can include custom
                    query string parameters if required by the server.
        :param headers: A dictionary with custom headers to send with the
                        connection request.
        :param transports: The list of allowed transports. Valid transports
                           are ``'polling'`` and ``'websocket'``. If not
                           given, the polling transport is connected first,
                           then an upgrade to websocket is attempted.
        :param namespaces: The list of custom namespaces to connect, in
                           addition to the default namespace. If not given,
                           the namespace list is obtained from the registered
                           event handlers.
        :param socketio_path: The endpoint where the Socket.IO server is
                              installed. The default value is appropriate for
                              most cases.

        Note: this method is a coroutine.

        Example usage::

            sio = socketio.Client()
            sio.connect('http://localhost:5000')