def METHOD_NAME(self, payload: Union[str, bytes]) -> None:
    if not self._session_id:
        return
    try:
        if isinstance(payload, str):
            # Sanity check. (The frontend should only be sending us bytes;
            # Protobuf.ParseFromString does not accept str input.)
            raise RuntimeError(
                "WebSocket received an unexpected `str` message. "
                "(We expect `bytes` only.)"
            )
        msg = BackMsg()
        msg.ParseFromString(payload)
        _LOGGER.debug("Received the following back message:\n%s", msg)
    except Exception as ex:
        _LOGGER.error(ex)
        self._runtime.handle_backmsg_deserialization_exception(self._session_id, ex)
        return
    # "debug_disconnect_websocket" and "debug_shutdown_runtime" are special
    # developmentMode-only messages used in e2e tests to test reconnect handling and
    # disabling widgets.
    if msg.WhichOneof("type") == "debug_disconnect_websocket":
        if config.get_option("global.developmentMode"):
            self.close()
        else:
            _LOGGER.warning(
                "Client tried to disconnect websocket when not in development mode."
            )
    elif msg.WhichOneof("type") == "debug_shutdown_runtime":
        if config.get_option("global.developmentMode"):
            self._runtime.stop()
        else:
            _LOGGER.warning(
                "Client tried to shut down runtime when not in development mode."
            )
    else:
        # AppSession handles all other BackMsg types.
        self._runtime.handle_backmsg(self._session_id, msg)