def event_stream(stream_id):
    """SSE stream handler for clients"""
    connected = True
    user = rtc.users_by_stream[stream_id]
    try:
        yield 'data: %s\n\n' % json.dumps(dict(event='hello', stream_id=stream_id))
    except:
        print stream_id % 'Error sending hello to %s'
        connected = False
        print 'Stream %s is disconnected' % stream_id
        rtc.disconnected(stream_id)
        return

    while connected:
        message = user.messages.get(block=True, timeout=None)
        if message != '{"event": "heartbeat"}':
            print 'Sending %s to %s' % (message, stream_id)
        try:
            yield 'data: %s\n\n' % message
        except:
            print 'socket Error sending message to %s' % stream_id
            connected = False
            print 'Stream %s is disconnected' % stream_id
            rtc.disconnected(stream_id)
            return
dataset/ETHPy150Open chalasr/Flask-P2P/app.py/event_stream/swapped operands of `%`