Making Elixir reactive like a Meteor app

So one of the really great things that Meteor does it update everything, everywhere in real time.

So if you’re on mobile and make a change and then go to web you’ll see the updates immediately sort of how Google docs does it. But everything is always up to date out of the box.

The problem with this approach is server load. It’s hard to scale, but it’s so nice having this functionality when you need it.

Any ideas if there are easy ways to do this using Elixir?

You can send and react to messages.

You connect to a server from a browser (probably websockets) and from a phone (might also be websockets). On the server you create a process for each connection. Whenever there is some data from either of the clients, the serving process sends a message to another process, so that the latter can push the data to its client.

What makes meteor reactive is DDP, Distributed Data Protocol.

While phoenix can be a DDP client, like in this blog Philae experiment, I did not find ddp server implementation.

Quoting @ryanswapp on Phoenix as a Meteor alternative

He basically said (Chris McCord) that Phoenix channels have been designed as low level infrastructure for people to build on top of and they talked about a potential DDP layer on top of that

I achieve kind of same reactive result with the use of channels and React/Redux on the client side.

But it can be even better with the use of Rxjs on the client side.

1 Like

Or use Drab! ^.^

4 Likes

Oooh, I didn’t knew about :joy: So nice!

1 Like