by sznurek · 14y ago · 0 comments
login_action = Write('PASS') >> \
Read('pass') >> \
Guard(lambda v: v['pass'] == 'mysecret') >> \
Write('WELCOME')
register(socket, login_action, on_success=func1, on_error=func2)
Of course you can develop this idea futher: cat = Read('line') >> Write(lambda v: v['line'])
cat.append_action(cat)
register(socket, cat, on_error=handle_error_cb)