Is it possible to make CouchApp send requests autonomously?
Asked Answered
G

2

5

I want to write very simple app, witch monitors states of some sites. I also want to make it in Couchapp style without using any environment except CouchDB.

So the question is how I can make CouchApp send sites requests using some schedule by itself?

BTW, if I fail with this CouchApp, is there some way to make it not involving demon stuff (or cron) on PHP or on even Java? I want to keep it as simple as possible, but not simpler.

Glenda answered 23/2, 2011 at 20:43 Comment(1)
Thank you all for answers. Really helpfull. Too bad I cannot choose both as right answers.)Glenda
S
3

You can't do it in CouchDB alone (CouchApps can only have pure functions without side effects so they can be guaranteed to be cacheable) but you can do it using simple scripts that talk to CouchDB. See this talk by Mikeal Rogers for details on how to do it.

Seeress answered 24/2, 2011 at 2:47 Comment(0)
G
5

rsp is correct. Since CouchDB uses web protocols and Javascript, it has become a victim of its own success.

My rule of thumb is this: CouchDB is a database. It stores your data. I do not expect MySQL to automatically monitor external web sites. Why would I expect CouchDB to do that?

However I agree; CouchDB always benefits from some persistent processing to maintain the data.

Since CouchDB is completely web-based, you could start with a simple dedicated "worker" web browser. Fetch a password-protected HTML page from CouchDB. That page has the Javascript to make the browser query servers and update CouchDB. This could work in the short-term as a quick solution. However browsers impose security restrictions on your queries; and also a browser is not a long-term computing platform.

The traditional way is to run your own client software to do these things. You can either run a dedicated computer, or use PHP, NodeJS, or any other hosting services out there. 2. The

Gavel answered 24/2, 2011 at 7:19 Comment(0)
S
3

You can't do it in CouchDB alone (CouchApps can only have pure functions without side effects so they can be guaranteed to be cacheable) but you can do it using simple scripts that talk to CouchDB. See this talk by Mikeal Rogers for details on how to do it.

Seeress answered 24/2, 2011 at 2:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.