Question about always on apps

Is it possible to run nodeJS Apps that are always on and listening to events emitted from an external data feed? And no, I don’t mean the external data feed will “call” the app. The needs to be running and it needs to detect the event by itself.
Is such a thing possible with Glitch?
I am sorry if this is a very beginner question. I am very new to hosting things directly.

Hi adi, welcome!

For a Glitch app to be “always on”, you need to Boost it by going pro (https://glitch.com/pricing)

As for your technical question, how are you planning to “detect” the event? Generally - and I apologise if I’m teaching you to suck eggs - we have three ways of monitoring an event:

  1. Polling - every x seconds/minutes your app checks the data feed (or some other source) for changes, and does its process
  2. Hook - this is what you say you don’t want; where the data source app notifies consumers that the data has changed
  3. Sockets - where two apps are interconnected by a constant communication stream

I don’t think 2 and 3 are practical for you, as it sounds like you’re consuming some third party data.

So that leaves us with Polling. I think there are a few different npm packages that you could install that would help:

Hope this helps. Let us know if you try something and want to talk about it some more :slight_smile:

3 Likes

I plan on Polling the events.

Also, I don’t want to keep accessing the webpage for the Glitch server to keep running when using Pro. Is that possible? Or even in the Pro version, you need to open up the browser?

Check out stefans-creative-bots, he has a good example of using node cron to schedule his twitter bots to run without intervention.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.