def run_in_twisted(self, url=DEFAULT_AUTOBAHN_ROUTER, realm=DEFAULT_AUTOBAHN_REALM,
                       authmethods=None, authid=None, authrole=None, authextra=None,
                       callback=None, **kwargs):
        """
        Start the WAMP connection. Given we cannot run synchronous stuff inside the
        twisted thread, use this function (which returns immediately) to do the
        initialization from a spawned thread.

        :param callback: function that will be called inside the spawned thread.
        Put the rest of you init (or you main loop if you have one) inside it

        :param authmethods: Passed to :meth:`autobahn.wamp.protocol.ApplicationSession.join`
        :param authid: Passed to :meth:`autobahn.wamp.protocol.ApplicationSession.join`
        :param authrole: Passed to :meth:`autobahn.wamp.protocol.ApplicationSession.join`
        :param authextra: Passed to :meth:`autobahn.wamp.protocol.ApplicationSession.join`

        .. note::
            This function must be called instead of :meth:`AutobahnSync.run`
            if we are calling from twisted application (typically if we are running
            our application inside crossbar as a `wsgi` component)
        """
        _init_crochet(in_twisted=True)
        logger.debug('run_in_crossbar, bootstraping')
        # No need to go non-blocking if no callback has been provided
        blocking = callback is None

        def bootstrap_and_callback():
            self._bootstrap(blocking, url=url, realm=realm,
                authmethods=authmethods, authid=authid, authrole=authrole,
                authextra=authextra, **kwargs)
            if callback:
                callback()
            self._callbacks_runner.start()

        threads.deferToThread(bootstrap_and_callback)