async def read_until(socket, messages):
    """
    Reads from socket until all messages from the list are received
    Returns the list of messages read
    """
    messages = messages.copy()
    res = []
    while messages:
        data = await socket.receive_json()
        res += [data]
        if data in messages:
            messages.remove(data)
    return res