Decorator for the :meth:`AutobahnSync.session.register`

        .. note::
            This decorator can be used before :meth:`AutobahnSync.run` is called.
            In such case the actual registration will be done at ``run()`` time.

def register(self, procedure=None, options=None):
        """Decorator for the :meth:`AutobahnSync.session.register`

        .. note::
            This decorator can be used before :meth:`AutobahnSync.run` is called.
            In such case the actual registration will be done at ``run()`` time.
        """

        def decorator(func):
            if self._started:
                self.session.register(endpoint=func, procedure=procedure, options=options)
            else:

                def registerer():
                    self.session.register(endpoint=func, procedure=procedure, options=options)

                # Wait for the WAMP session to be started
                self._on_running_callbacks.append(registerer)
            return func

        return decorator