Function to receive messages

        Parameters
        ----------
        connection: socket or connection

        Return value
        ------------
        message received as dictionary

def recv_msg(self, connection):
        """
        Function to receive messages

        Parameters
        ----------
        connection: socket or connection

        Return value
        ------------
        message received as dictionary
        """
        # Read message length and unpack it into an integer
        raw_msglen = self.__recvall(connection, 4, decode_json=False)
        if not raw_msglen:
            return None
        msglen = struct.unpack('>I', raw_msglen)[0]
        # Read the message data
        return self.__recvall(connection, msglen)