Question

I am trying to build a web-app that has both a Python part and a Node.js part. The Python part is a RESTful API server, and the Node.js will use sockets.io and act as a push server. Both will need to access the same DB instance (Heroku Postgres in my case). The Python part will need to talk to the Node.js part in order to send push messages to be delivered to clients.

I have the Python and DB parts built and deployed, running under a "web" dyno. I am not sure how to build the Node part -- and especially how the Python part can talk to the Node.js part.

I am assuming that the Node.js will need to be a new Heroku app, so that it too can run on a 'web' dyno, so that it benefits from the HTTP routing stack, and clients can connect to it. In such a case, will my Python dynos will be accessing it using just like regular clients?

What are the alternatives? How is this usually done?

Was it helpful?

Solution

After having played around a little, and also doing some reading, it seems like Heroku apps that need this have 2 main options:

1) Use some kind of back-end, that both apps can talk to. Examples would be a DB, Redis, 0mq, etc.

2) Use what I suggested above. I actually went ahead and implemented it, and it works.

Just thought I'd share what I've found.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top