(self, opcode=None, body='', masking_key=None, fin=0, rsv1=0, rsv2=0, rsv3=0)
Implements the framing protocol as defined by RFC 6455.

        .. code-block:: python
           :linenos:

           >>> test_mask = 'XXXXXX' # perhaps from os.urandom(4)
           >>> f = Frame(OPCODE_TEXT, 'hello world', masking_key=test_mask, fin=1)
           >>> bytes = f.build()
           >>> bytes.encode('hex')
           '818bbe04e66ad6618a06d1249105cc6882'
           >>> f = Frame()
           >>> f.parser.send(bytes[0])
           1
           >>> f.parser.send(bytes[1])
           4

        .. seealso:: Data Framing http://tools.ietf.org/html/rfc6455#section-5.2
Implements the framing protocol as defined by RFC 6455.
Implements the framing protocol as defined by RFC 6455 .
def __init__(self, opcode=None, body='', masking_key=None, fin=0, rsv1=0, rsv2=0, rsv3=0):
        """
        Implements the framing protocol as defined by RFC 6455.

        .. code-block:: python
           :linenos:

           >>> test_mask = 'XXXXXX' # perhaps from os.urandom(4)
           >>> f = Frame(OPCODE_TEXT, 'hello world', masking_key=test_mask, fin=1)
           >>> bytes = f.build()
           >>> bytes.encode('hex')
           '818bbe04e66ad6618a06d1249105cc6882'
           >>> f = Frame()
           >>> f.parser.send(bytes[0])
           1
           >>> f.parser.send(bytes[1])
           4

        .. seealso:: Data Framing http://tools.ietf.org/html/rfc6455#section-5.2
        """
        self.opcode = opcode
        self.body = body
        self.masking_key = masking_key
        self.fin = fin
        self.rsv1 = rsv1
        self.rsv2 = rsv2
        self.rsv3 = rsv3
        self.payload_length = len(body)

        self._parser = None
def __init__ ( self , opcode = None , body = '' , masking_key = None , fin = 0 , rsv1 = 0 , rsv2 = 0 , rsv3 = 0 ) : self . opcode = opcode self . body = body self . masking_key = masking_key self . fin = fin self . rsv1 = rsv1 self . rsv2 = rsv2 self . rsv3 = rsv3 self . payload_length = len ( body ) self . _parser = None