Realtime Ember with Rails API (RethinkDB) backend


#1

Hello!

For testing purposes I wrote backend and front end just to list up tasks:

  1. Rails5 API server https://github.com/tenzan/rails-todo-api .
  2. Ember frontend https://github.com/tenzan/ember-todo-ui

With Ember I’m able to retrieve tasks list from the rails backend, but I need to refresh browser to see if there any new tasks added.

I want to implement a real-time update on front-end.

With Rails 5 we now can use actioncable to implement a realtimeness and there are some working examples out there (which I still can’t get how they work), where Rails5 used as a full-stack.

As I mentioned above, for DB I’m using RethinkDB, which by itself also offers Changefeeds feature.

https://www.rethinkdb.com/docs/changefeeds/ says:

Changefeeds lie at the heart of RethinkDB’s real-time functionality. They allow clients to receive changes on a table, a single document, or even the results from a specific query as they happen.

My question is implementation of real-time app will be different depending if your DB is RethinkDB or not? And how implementation in Ember would look like?

I wasn’t able to find any working example with Ember that shows changes in realtime once RethinkDB is changed.

Here some examples https://www.rethinkdb.com/docs/examples/

I’d be very obliged if someone could show me some direction for my Ember frontend https://github.com/tenzan/ember-todo-ui


#2

Checkout ember-pouch. If you change something on https://bloggr.exmer.com/ it almost real-time changes on other browsers. Pouch handles this using Longpoll. Because it is just an ember-data adapter it all works out of the box. I think you also need an ember-data adapter for RethinkDB. It seems you will have to write it yourself…