'Useful for streaming handlers that want to break up messages into
frames themselves. Note that these frames will be interleaved with
control frames, so they should not be too large.'

def send_websocket_frame(self, data, is_first=True, is_last=True):

    opcode = ((TEXT if isinstance(data, type(u'')) else BINARY) if is_first else CONTINUATION)
    fin = (1 if is_last else 0)
    frame = create_frame(fin, opcode, data)
    with self.cf_lock:
        self.control_frames.append(ReadOnlyFileBuffer(frame))
