@app.route('/api')
def api():
    """WebSocket endpoint; Takes a 'topic' GET param."""
    ws = request.environ.get('wsgi.websocket')
    topic = request.args.get('topic')

    if None in (ws, topic):
        return

    topic = topic.encode('ascii')
    for message, message_topic in CircusConsumer(topic, endpoint=ZMQ_ENDPOINT):
        response = json.dumps(dict(message=message, topic=message_topic))
        ws.send(response)
dataset/ETHPy150Open circus-tent/circus/examples/webclient/bread.py/api/original