On Tue, Nov 6, 2018 at 4:51 PM, Chris Withers <ch...@withers.org> wrote:

> 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
> Twisted-Python@twistedmatrix.com
> https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>


If you have not yet looked at the AutoBahn site, then I would do so. I
think you will find some good examples of dealing with web sockets and
twisted.

I don't know anything much about web sockets so can't offer much more that
this.

Here is a link

https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/websocket/echo

Regards

John Aherne


-- 
*John Aherne*




*www.rocs.co.uk <http://www.rocs.co.uk>*
020 7223 7567
_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to