def decode(data):
    messages = []

    idx = 0

    while data[idx:idx+3] == FRAME:
        # Skip frame
        idx += 3

        len_start = idx
        while data[idx].isdigit():
            idx += 1

        msg_len = int(data[len_start:idx])

        msg_type = data[idx:idx + 3]

        # Skip message type
        idx += 3

        msg_data = data[idx:idx + msg_len]

        if msg_data.startswith(JSON):
            msg_data = json.loads(msg_data[3:])
        elif msg_data.startswith(HEARTBEAT):
            msg_type = HEARTBEAT
            msg_data = msg_data[3:]

        messages.append((msg_type, msg_data))

        idx += msg_len

    return messages
Registers a single callback for receiving an event (or event list). Optionally,
dataset/ETHPy150Open mrjoes/tornadio/tornadio/proto.py/decode--crossover with--dataset/ETHPy150Open shaunduncan/smokesignal/smokesignal.py/on