I am building a simple rails application and am working with Tornado for some of the real-time parts of the app. My experience thus far as been limited to using a single web framework for all my needs. First time I am using two different web frameworks.
I am confused as to how rails and tornado can work together. So, I have a rails server and a tornado server running on different ports. They both will handle their own requests via their routing configuration. The backend make sense. The part I am confused about is the front-end integration. Let us say I have a page which shows my logged in/logged out status along with real-time stream of tweets from Twitter with a delete button next to each tweet. The logged/logged out status is known to my rails server. The tweets are being handled by my Tornado server. How do I integrate both pieces of information from the two servers in the front-end?
Do I call the Tornado server from my rails controller and process the JSON? If so, won’t I lose the real-time aspect of things?
Do I use an iframe in my .erb template which calls the Tornado server? If so, how do I integrate the iframe with the delete buttons next to each tweet?
Thanks in advance!
I would run tornado and rails on two different ports (not port 80). I would run nginx on port 80. I would configure nginx to proxy for tornado in the /realtime name space and to rails everywhere else. Now your client said JS code just asks the server for different URLs and it never has to know which one is which.