Originally the only option was to register a general result or fault event handler at the service component level or method level. That's OK if you either don't need any extra context when you handle the result or fault or if you want to manually store some call context on the returned token and then access that when a result or fault eventually gets back to the client, but it can get somewhat complicated when you're handling all results and faults generically at the service level for a component that provides many service methods.
There are also scenarios where you may just want to define lambda functions in-line to handle the result or fault for a specific invocation. That's where adding a responder can be a simpler approach. Note that you add a responder to the token for a single call - each invocation gets a unique token so there's really no reason to remove or swap it out. If the responder was reused for more than one call or for handling a variety of calls that might make sense. So, you can do something like: token.addResponder(new AsyncResponder(<lambda function to handle result>, <lambda funtion to handle fault>)); Because these functions capture their enclosing state, this can also simply result and fault handling, letting you avoid having to manually store and manage any local state or context for the invocation that your result and fault handlers might need. Each approach has its advantages and disadvantages, so use the one that makes the most sense for your specific scenario. A single application may use a combination of these two approaches, with general result/fault handling for some calls and per-invocation handling via a responder for other calls. Best, Seth ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Josh McDonald Sent: Wednesday, February 06, 2008 9:02 PM To: [email protected] Subject: [flexcoders] RPC: AsyncToken.addResponder vs addEventListener? What's the prevailing wind / general thoughts on using token.addResponder vs adding event listeners, beside the "one request" vs "all requests" nature of it? Is one faster / better / more common that the other? -- "Good people will do good things, and bad people will do bad things. But for good people to do bad things-that takes religion." :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>

