Re: "blocking" on a response to a client

Chris Withers <[email protected]>
Newsgroups gmane.comp.python.twisted
Message-ID <[email protected]>
On 06/11/2018 13:47, Jean-Paul Calderone wrote:
>     Thanks, but the special bit I was asking about is having my
>     application's logical flow pause until the websocket is successfully up
>     and a successful response has been received, all without blocking the
>     reactor.
> 
>     How do I do that?
> 
> 
> Put the rest of your code in a callback on a Deferred that fires when 
> the event you're interested in happens.  When using inlineCallbacks, 
> that's like:
> 
>      yield the_event_youre_interested_in
>      # ... more code
> 
> At least, this is the extremely-localized solution to the problem.  
> There are many possible ways to structure such a thing.  It's easy to 
> describe this one because you said you're using inlineCallbacks and 
> didn't say anything else about how your code is organized.

Right, but I'm still too stupid to join the dots :-(

More concretely, I want to spin up an autobahn websocket client, have it 
connect, send a login message, confirm that worked, send a 'create' 
message, confirm that worked, and *then* let the rest of my code progress...

I'm surprised there don't appear to be any example of this floating 
around, and disappointed at the lack of examples of good tests for these 
things.

Chris

_______________________________________________
Twisted-Python mailing list
[email protected]
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.