def _wrap_data(data: Union[str, bytes]):
        """
        Wraps data into the right event.
        """
        MsgType = TextMessage if isinstance(data, str) else BytesMessage
        return MsgType(data=data, frame_finished=True, message_finished=True)