def connect(self, packet=None):
        """Connect to the server.

        :param packet: RTMPPacket, this packet will be sent instead
                       of the regular "connect" packet.

        Raises :exc:`RTMPError` if the connect attempt fails.

        """

        if isinstance(packet, RTMPPacket):
            packet = packet.packet
        else:
            packet = ffi.NULL

        res = librtmp.RTMP_Connect(self.rtmp, packet)
        if res < 1:
            raise RTMPError("Failed to connect")

        return RTMPCall(self, 1.0)
Connect to the server.

        :param packet: RTMPPacket, this packet will be sent instead
                       of the regular "connect" packet.

        Raises :exc:`RTMPError` if the connect attempt fails.