Giter VIP home page Giter VIP logo

Comments (6)

jcheng5 avatar jcheng5 commented on August 10, 2024

I'll look into it, thanks for the suggestion.

from httpuv.

hcorrada avatar hcorrada commented on August 10, 2024

I'm not too familiar with libuv, but I'd be happy to help if you point me in the general direction :-)

from httpuv.

jeroen avatar jeroen commented on August 10, 2024

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.

jcheng5 avatar jcheng5 commented on August 10, 2024

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.

hcorrada avatar hcorrada commented on August 10, 2024

'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.

jeroen avatar jeroen commented on August 10, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.