(data, opcode)
return ABNF(1, 0, 0, 0, opcode, 1, data)
create frame to send text, binary and other data.

        data: data to send. This is string value(byte array).
            if opcode is OPCODE_TEXT and this value is uniocde,
            data value is conveted into unicode string, automatically.

        opcode: operation code. please see OPCODE_XXX.
create frame to send text, binary and other data.
create frame to send text binary and other data .
def create_frame(data, opcode):
        """
        create frame to send text, binary and other data.

        data: data to send. This is string value(byte array).
            if opcode is OPCODE_TEXT and this value is uniocde,
            data value is conveted into unicode string, automatically.

        opcode: operation code. please see OPCODE_XXX.
        """
        if opcode == ABNF.OPCODE_TEXT and isinstance(data, unicode):
            data = data.encode("utf-8")
        # mask must be set if send data from client
        return ABNF(1, 0, 0, 0, opcode, 1, data)
def create_frame ( data , opcode ) : if opcode == ABNF . OPCODE_TEXT and isinstance ( data , unicode ) : data = data . encode ( "utf-8" ) # mask must be set if send data from client return ABNF ( 1 , 0 , 0 , 0 , opcode , 1 , data )