def as_client(self, as_client=True, server='http://localhost:5555',
                  bundleid=None):
        """
        [NOT IMPLEMENTED]
        """
        if as_client:
            if not _can_client:
                raise ImportError("dependencies to support client mode not met - see docs")

            server_running = self._test_server(server=server,
                                               start_if_fail=True)
            if not server_running:
                raise ValueError("server {} is not running".format(server))

            server_split = server.split(':')
            host = ':'.join(server_split[:-1])
            port = int(float(server_split[-1] if len(server_split) else 8000))
            self._socketio = SocketIO(host, port, BaseNamespace)
            self._socketio.on('connect', self._on_socket_connect)
            self._socketio.on('disconnect', self._on_socket_disconnect)

            self._socketio.on('push updates', self._on_socket_push_updates)

            if not bundleid:
                upload_url = "{}/upload".format(server)
                logger.info("uploading bundle to server {}".format(upload_url))
                data = json.dumps(self.to_json(incl_uniqueid=True))
                r = requests.post(upload_url, data=data, timeout=5)
                bundleid = r.json()['meta']['bundleid']

            self._socketio.emit('subscribe bundle', {'bundleid': bundleid})

            self._bundleid = bundleid

            self._is_client = server
            logger.info("connected as client to server at {}:{}".
                        format(host, port))

        else:
            logger.warning("This bundle is now permanently detached from the instance\
                on the server and will not receive future updates.  To start a client\
                in sync with the version on the server or other clients currently \
                subscribed, you must instantiate a new bundle with Bundle.from_server.")

            if hasattr(self, '_socketIO') and self._socketIO is not None:
                self._socketio.emit('unsubscribe bundle', {'bundleid': bundleid})
                self._socketIO.disconnect()
                self._socketIO = None

            self._bundleid = None
            self._is_client = False
def as_client ( self , as_client = True , server = 'http://localhost:5555' , bundleid = None ) : if as_client : if not _can_client : raise ImportError ( "dependencies to support client mode not met - see docs" ) server_running = self . _test_server ( server = server , start_if_fail = True ) if not server_running : raise ValueError ( "server {} is not running" . format ( server ) ) server_split = server . split ( ':' ) host = ':' . join ( server_split [ : - 1 ] ) port = int ( float ( server_split [ - 1 ] if len ( server_split ) else 8000 ) ) self . _socketio = SocketIO ( host , port , BaseNamespace ) self . _socketio . on ( 'connect' , self . _on_socket_connect ) self . _socketio . on ( 'disconnect' , self . _on_socket_disconnect ) self . _socketio . on ( 'push updates' , self . _on_socket_push_updates ) if not bundleid : upload_url = "{}/upload" . format ( server ) logger . info ( "uploading bundle to server {}" . format ( upload_url ) ) data = json . dumps ( self . to_json ( incl_uniqueid = True ) ) r = requests . post ( upload_url , data = data , timeout = 5 ) bundleid = r . json ( ) [ 'meta' ] [ 'bundleid' ] self . _socketio . emit ( 'subscribe bundle' , { 'bundleid' : bundleid } ) self . _bundleid = bundleid self . _is_client = server logger . info ( "connected as client to server at {}:{}" . format ( host , port ) ) else : logger . warning ( "This bundle is now permanently detached from the instance\
                on the server and will not receive future updates.  To start a client\
                in sync with the version on the server or other clients currently \
                subscribed, you must instantiate a new bundle with Bundle.from_server." ) if hasattr ( self , '_socketIO' ) and self . _socketIO is not None : self . _socketio . emit ( 'unsubscribe bundle' , { 'bundleid' : bundleid } ) self . _socketIO . disconnect ( ) self . _socketIO = None self . _bundleid = None self . _is_client = False
[NOT IMPLEMENTED]