Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Feature Request: stdin.on('data') event #11319

Closed
anacronw opened this issue May 14, 2013 · 6 comments
Closed

Feature Request: stdin.on('data') event #11319

anacronw opened this issue May 14, 2013 · 6 comments

Comments

@anacronw
Copy link

I wish to use phantom as part of a service through node. It seems as though spawning a new phantom process takes nearly an entire second in itself.

I wish to keep one or more long running phantom processes, and feed data through stdin. Upon receipt of the data, phantom would process and spit with stdout.

Same request found here: http://stackoverflow.com/questions/16038342/event-listener-for-phantomjs-stdin

Is there a way to do this now? Perhaps simply polling stdin?

@ariya
Copy link
Owner

ariya commented May 15, 2013

I think streaming stdin has been filed, search this issue tracker.

Also, for your purpose, you can just use WebSocket or WebServer module. Check out some projects using PhantomJS, e.g. Poltergeist, various screen capture, etc.

@JamesMGreene
Copy link
Collaborator

Duplicate of #10980, for the most part.

@anacronw
Copy link
Author

Thanks for the quick response.

I searched the issue tracker many times w/ diff keywords, I ran into #10980, but there it talks about a non-blocking interface. I am looking for a way to hook into events to know when something is pushed into stdin buffer. Maybe I misunderstood #10980, but those are two diff things to me.

@ariya's suggestion about websocket/webserver is along the right lines, but was wondering if one exists for stdin. Webserver seemed a bit heavyweight, but I will give that a try.

Thanks again!

@anacronw
Copy link
Author

After executing the same thing on linux, response time was reduced to ~400-500ms from previously ~1100ms.

After using the webserver method, it reduced it further to ~140ms!

Thank you

@TaDaa
Copy link

TaDaa commented Dec 22, 2014

Can we reopen this? Not sure why it was closed ? webserver fits a few use cases, but phantomjs should definitely include a stdin onData event.

@ricardograca
Copy link

@TaDaa I think it's because there's already #10980 that deals with that as well.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants