예제 #1
0
def _create_logical_frame(channel_id,
                          message,
                          opcode=common.OPCODE_BINARY,
                          mask=True):
    bits = chr(0x80 | opcode)
    payload = mux._encode_channel_id(channel_id) + bits + message
    return create_binary_frame(payload, mask=mask)
예제 #2
0
def _create_add_channel_request_frame(channel_id, encoding, encoded_handshake):
    if encoding != 0 and encoding != 1:
        raise ValueError('Invalid encoding')
    block = mux._create_control_block_length_value(
        channel_id, mux._MUX_OPCODE_ADD_CHANNEL_REQUEST, encoding,
        encoded_handshake)
    payload = mux._encode_channel_id(mux._CONTROL_CHANNEL_ID) + block
    return create_binary_frame(payload, mask=True)
예제 #3
0
def _create_add_channel_request_frame(channel_id, encoding, encoded_handshake):
    if encoding != 0 and encoding != 1:
        raise ValueError('Invalid encoding')
    block = mux._create_control_block_length_value(
               channel_id, mux._MUX_OPCODE_ADD_CHANNEL_REQUEST, encoding,
               encoded_handshake)
    payload = mux._encode_channel_id(mux._CONTROL_CHANNEL_ID) + block
    return create_binary_frame(payload, mask=True)
예제 #4
0
def _create_logical_frame(channel_id, message, opcode=common.OPCODE_BINARY,
                          mask=True):
    bits = chr(0x80 | opcode)
    payload = mux._encode_channel_id(channel_id) + bits + message
    return create_binary_frame(payload, mask=mask)