Exemple #1
0
# coding: utf8
from fadeaway.client import ServerProxy
from fadeaway.client import Sync

if __name__ == '__main__':
    ss = ServerProxy(Sync, 'localhost', 9151)
    d = ss.Demo()
    print d.test_string('Lucy')
    print d.test_number(1)
    print d.test_array([1, '2', 3.14, 4])
    print d.test_dict({"name": "Billy"})
    print d.test_mix(-1, 'greetings', ['a', 'b', 'c'], {"abc": 123})
# coding: utf8
from fadeaway.client import ServerProxy
from fadeaway.client import Async

def callback(res, error=None):
    '''error will be set if there is an error while calling'''
    if not error:
        print '[callback]', res
    else:
        print error

def callback_for_mix(num_arg, str_arg, list_arg, dict_arg, error=None):
    if not error:
        print '[mix callback]', num_arg, str_arg, list_arg, dict_arg
    else:
        print error

if __name__ == '__main__':
    ss = ServerProxy(Async, 'localhost', 9151)
    ss.deploy()
    d = ss.Demo()
    d.hello('billy').then(callback, timeout=3)
    d.hello('rowland').then(callback, timeout=7)
    d.hello('lily').then(callback)
    d.hello('qqq').then(callback, timeout=7)
    d.hello('ccc').then(callback, timeout=3)
    d.test_number(222).then(callback, timeout=1)
    d.test_mix(-1, 'greetings', ['a', 'b', 'c'], {"abc": 123}).then(callback)
Exemple #3
0
# coding: utf8
from fadeaway.client import ServerProxy
from fadeaway.client import Async


def connected():
    print 'connected!'


def disconnected():
    print 'disconnected!'


if __name__ == '__main__':
    ss = ServerProxy(Async, 'localhost', 9151)
    ss.monitor('wo', connected, disconnected)
    ss.deploy()
Exemple #4
0
from fadeaway.client import ServerProxy
from fadeaway.client import Async


def callback(res, error=None):
    '''error will be set if there is an error while calling'''
    if not error:
        print '[callback]', res
    else:
        print error


def callback_for_mix(num_arg, str_arg, list_arg, dict_arg, error=None):
    if not error:
        print '[mix callback]', num_arg, str_arg, list_arg, dict_arg
    else:
        print error


if __name__ == '__main__':
    ss = ServerProxy(Async, 'localhost', 9151)
    ss.deploy()
    d = ss.Demo()
    d.hello('billy').then(callback, timeout=3)
    d.hello('rowland').then(callback, timeout=7)
    d.hello('lily').then(callback)
    d.hello('qqq').then(callback, timeout=7)
    d.hello('ccc').then(callback, timeout=3)
    d.test_number(222).then(callback, timeout=1)
    d.test_mix(-1, 'greetings', ['a', 'b', 'c'], {"abc": 123}).then(callback)
Exemple #5
0
# coding: utf8
from fadeaway.client import ServerProxy
from fadeaway.client import Async

def connected():
    print 'connected!'

def disconnected():
    print 'disconnected!'

if __name__ == '__main__':
    ss = ServerProxy(Async, 'localhost', 9151)
    ss.monitor('wo', connected, disconnected)
    ss.deploy()