Comments (6)
I'll look into it, thanks for the suggestion.
from httpuv.
I'm not too familiar with libuv, but I'd be happy to help if you point me in the general direction :-)
from httpuv.
That would be fantastic. How would this work with R's single thread limitation? It seems to me you either need to block or fork the R session to be able to serve a request?
from httpuv.
There is a mechanism by which R will call your code back occasionally to let you do work, called addInputHandler
. I'm not sure how well documented it is, but if you look in the R source you can see how it works (Rhttpd uses it). Essentially you will get called back on the main thread once in a while.
Sadly this isn't available on Windows, so on that platform you need to create a hidden window on the main thread, then launch a second thread to monitor your events with; when an event is ready to be handled then you post a message onto the hidden window, and that window's window procedure will process the events.
It's all a little hairy but can and has been done before.
from httpuv.
'addInputHandler' is what the websockets library used in unix. So, one
option is to go the sam route and only support this on unix. Would that
make sense as a start?
On Wed, May 8, 2013 at 8:20 PM, Joe Cheng [email protected] wrote:
There is a mechanism by which R will call your code back occasionally to
let you do work, called addInputHandler. I'm not sure how well documented
it is, but if you look in the R source you can see how it works (Rhttpd
uses it). Essentially you will get called back on the main thread once in a
while.Sadly this isn't available on Windows, so on that platform you need to
create a hidden window on the main thread, then launch a second thread to
monitor your events with; when an event is ready to be handled then you
post a message onto the hidden window, and that window's window procedure
will process the events.It's all a little hairy but can and has been done before.
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-17642369
.
from httpuv.
I would recommend to imitate as closely as possible what Rhttpd is doing. The undocumented parts of R often get breaking changes between versions, with no warnings from R-core. The last thing you want is everything breaking down in a future version of R due to some internal changes.
from httpuv.
Related Issues (20)
- staticPath logging HOT 1
- HTTP/2 support HOT 2
- Random crashes on MacOS HOT 16
- Unable to install httput - R 4.2.2 HOT 3
- Warning with clang 16 HOT 2
- Possible to use multiple worker threads? HOT 2
- Unable to install httpuv - R 3.5.3 HOT 2
- macOS: Assertion fails when closing `{httpuv}` server HOT 2
- CRAN firedrill 2023-05 HOT 4
- clang-ASAN: "runtime error: applying zero offset to null pointer"
- httpuv v1.6.11 release checklist HOT 1
- httpuv 1.6.10 crashes with "uv__finish_close: Assertion `handle->flags & UV_HANDLE_CLOSING' failed" HOT 4
- Don't dynamically link to libuv on macOS
- CI workflows for sanitizers HOT 1
- Simple server API HOT 1
- Heartbeat in discord HOT 1
- Compile error with clang on WIndows HOT 1
- Release httpuv 1.6.12
- warning: format string is not a string literal
- Release httpuv 1.6.13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from httpuv.