Пример #1
0
    
def on_value_read_specific(snapshot): 
    print snapshot.val(), "<specific"

def onCancel(data): 
    print 'On was canceled'

def onComplete(data): 
    print 'Set was completed', data

#flame.auth( AUTH_KEY )

# Push only works on Unix boxes, need to fix _get_push_id to work cross platform
#sms.push("Push test") 
flame.on('child_added', on_child_added, onCancel)
flame.once('child_added', on_child_added)
flame.on('child_removed', on_child_removed )
flame.child('dat').on('value', on_value_read)
flame.child('online').set(True, onComplete)
flame.child('online').setPriority(100)
flame.child('online').onDisconnect().set(False)
flame.child("test").on('child_added', on_child_added)
flame.child("test").on('value', on_value_read)
flame.child('dat').update({'broom': 'bristle'})
flame.child("test").off('value')

# Querying half works, when your supply a query with a larger scope (ie a "value" bind to a parent)
# it breaks because we're not filtering incoming results.
#sms.startAt(None, '-Ip_SsFU5LY_63gH07x2').limit(3).on('child_added', say_body)
flame.child('-Ip_SxEZ-ZG7Q1yfPiuf').on('value', on_value_read_specific)