def getPayloadLen7(self):
     if self.getByteLen()<2:
         raise FrameHeaderIncomplete
     ba=ByteArray(self._bytes)
     ret=ByteArray()
     ret.bitOperation[1]=ba.bitOperation[9:16]
     i=ret.toDecimal()
     return i
 def getExtendedPayloadLen64(self):
     if self.getByteLen()<10:
         raise FrameHeaderIncomplete
     ba=ByteArray(self._bytes)
     ret=ByteArray()
     ret.bitOperation[0]=ba.bitOperation[16:80]
     i=ret.toDecimal()
     return i    
 def generateResponseFrame(payload):
     bytes=ByteArray()
     bytes.bitOperation[0]="100000010"
     leng=len(payload)
     
     if leng<126:
         bytes[1]=leng
     elif leng < 65536:
         bytes[1]=126
         bString=ByteArray(struct.pack(">H",leng))
         bString=str(bString.bitOperation)
         bytes.bitOperation[16]=bString
         
     else:
         bytes[1]=127
         bString=ByteArray(struct.pack(">Q",leng))
         bString=str(bString.bitOperation)
         bytes.bitOperation[16]=bString
         
     bytes=b"".join([bytes,payload])
     return bytes