This issue is related to later >= 1.0.0 which introduces private event loops.
The first observation is that httpuv uses only the global event loop even if startServer() is called inside later::with_temp_loop().
The problem is that service() does not execute the callbacks registered in the global loop when called inside later::with_temp_loop().
This comes from the fact that later::run_now() executes the callbacks registered in the current loop.
Originally posted in https://github.com/rstudio/pagedown/issues/150
This issue is related to later >= 1.0.0 which introduces private event loops.
The first observation is that httpuv uses only the global event loop even if
startServer()
is called insidelater::with_temp_loop()
.The problem is that
service()
does not execute the callbacks registered in the global loop when called insidelater::with_temp_loop()
. This comes from the fact thatlater::run_now()
executes the callbacks registered in the current loop.https://github.com/rstudio/httpuv/blob/57e1d715587acd16b566a910551d08a399d96656/R/httpuv.R#L588-L615
For now, the workaround is to use
later::with_loop(later::global_loop(), httpuv::service())
instead ofhttpuv::service()
.