run twisted reactor under Flask server
- Vassili Gontcharov
- 2013-03-09 @ 21:26
I use Flask with SocketIOServer and it works well.
Now I have to use the twisted under Flask to connect a external
server, a library what I use comes with twisted.
I tried to use the twisted reactor under my Flask development server
but something look like blocked until Ctrl+C
Re: [flask] run twisted reactor under Flask server
- Wouter Bolsterlee
- 2013-03-13 @ 21:05
Vassili Gontcharov schreef op za 09-03-2013 om 22:26 [+0100]:
> I tried to use the twisted reactor under my Flask development server
> but something look like blocked until Ctrl+C
That's likely because you run the main loop in Twisted (the reactor)
as a blocking call from the same thread that serves your web requests.
Try using a background thread instead.