(self)
return frame
recieve data as frame from server.

        return value: ABNF frame object.
recieve data as frame from server.
recieve data as frame from server .
def recv_frame(self):
        """
        recieve data as frame from server.

        return value: ABNF frame object.
        """
        header_bytes = self._recv_strict(2)
        if not header_bytes:
            return None
        b1 = ord(header_bytes[0])
        fin = b1 >> 7 & 1
        rsv1 = b1 >> 6 & 1
        rsv2 = b1 >> 5 & 1
        rsv3 = b1 >> 4 & 1
        opcode = b1 & 0xf
        b2 = ord(header_bytes[1])
        mask = b2 >> 7 & 1
        length = b2 & 0x7f

        length_data = ""
        if length == 0x7e:
            length_data = self._recv_strict(2)
            length = struct.unpack("!H", length_data)[0]
        elif length == 0x7f:
            length_data = self._recv_strict(8)
            length = struct.unpack("!Q", length_data)[0]

        mask_key = ""
        if mask:
            mask_key = self._recv_strict(4)
        data = self._recv_strict(length)
        if traceEnabled:
            recieved = header_bytes + length_data + mask_key + data
            logger.debug("recv: " + repr(recieved))

        if mask:
            data = ABNF.mask(mask_key, data)

        frame = ABNF(fin, rsv1, rsv2, rsv3, opcode, mask, data)
        return frame
def recv_frame ( self ) : header_bytes = self . _recv_strict ( 2 ) if not header_bytes : return None b1 = ord ( header_bytes [ 0 ] ) fin = b1 >> 7 & 1 rsv1 = b1 >> 6 & 1 rsv2 = b1 >> 5 & 1 rsv3 = b1 >> 4 & 1 opcode = b1 & 0xf b2 = ord ( header_bytes [ 1 ] ) mask = b2 >> 7 & 1 length = b2 & 0x7f length_data = "" if length == 0x7e : length_data = self . _recv_strict ( 2 ) length = struct . unpack ( "!H" , length_data ) [ 0 ] elif length == 0x7f : length_data = self . _recv_strict ( 8 ) length = struct . unpack ( "!Q" , length_data ) [ 0 ] mask_key = "" if mask : mask_key = self . _recv_strict ( 4 ) data = self . _recv_strict ( length ) if traceEnabled : recieved = header_bytes + length_data + mask_key + data logger . debug ( "recv: " + repr ( recieved ) ) if mask : data = ABNF . mask ( mask_key , data ) frame = ABNF ( fin , rsv1 , rsv2 , rsv3 , opcode , mask , data ) return frame