Add a before websocket function.

        This is designed to be used as a decorator. An example usage,

        .. code-block:: python

            @app.before_websocket
            def func():
                ...

        Arguments:
            func: The before websocket function itself.
            name: Optional blueprint key name.

def before_websocket(self, func: Callable, name: AppOrBlueprintKey=None) -> Callable:
        """Add a before websocket function.

        This is designed to be used as a decorator. An example usage,

        .. code-block:: python

            @app.before_websocket
            def func():
                ...

        Arguments:
            func: The before websocket function itself.
            name: Optional blueprint key name.
        """
        handler = ensure_coroutine(func)
        self.before_websocket_funcs[name].append(handler)
        return func