Drab: remote controlled frontend framework for Phoenix

@doogs Did you upgrade all those libraries I mentioned to latest releases?

I just bumped phoenix, distillery & drab. still not working.

When I bumped elixir i now get an error with elixir 1.5 on local build.
What version of elixir did you go to? I could only see that gigalixir supported 1.5?

okay i found the elixir buildpack file and put to latest on gigalixer.
this solved the drab issue.
I think this is because default elixir is 1.5 on gigalixir. but drab need at least 1.6?

anyways. now I habe a new issue.

Installing and caching node modules
remote: cp: cannot overwrite non-directory ‘node_modules/phoenix’ with directory ‘/tmp/cache/node_modules/phoenix’
remote: cp: cannot overwrite non-directory ‘node_modules/phoenix_html’ with directory ‘/tmp/cache/node_modules/phoenix_html’
remote: Command '[u'docker', u'run', u'--rm', u'-e', u'GIGALIXIR_SHOULD_CLEAN_CACHE=False', u'-v', u'/tmp/tmpPhv5iv/key-burlywood-degu:/tmp/app', u'-v', u'/tmp/gigalixir/cache/key-burlywood-degu/:/tmp/cache', u'-v', u'/tmp/tmpPhv5iv/env:/tmp/env', u'--env=USER=www-data', u'us.gcr.io/gigalixir-152404/herokuish:latest']' returned non-zero exit status 1
{:phoenix, "~> 1.3.4"},
{:distillery, "~> 2.0.10"},
{:drab, "~> 0.9.3"},
Elixir 1.7.3 (compiled with Erlang/OTP 21)



are you using any config for the phoenix_static_buildpack.config ?
Seems to be where my issue is now.

ended up changing my node version via phoenix_static_buildpack.config
That seemed to fix it, we have deployment!

1 Like

Hmm… dont think so, haven’t had a need to touch that

Hey, I have an issue with the Commander subscribe and Element.broadcast_html

I have 2 users connected to an app which has a Drab page.
When each user visits a page they are connected to a Drab topic via subscribe.
Each user is subscribed to a different topic.
When an event happens I broadcast_html to each relevant topic.
This all works as expected if no users refreshes their browser. Message are sent to the correct topics and displayed to the user.
When one of the user refreshes their browser, it changed the topic of the other user.
So when the next broadcast_html is called it is pushing data to the both users, thinking they are both on the same topic.

Both users are on the same url e.g /staff/
I am subscribing users to a topic using the ‘onconnect :connected’ callback.
subscribe(socket, same_topic(brand_id))

I am broadcasting with something like this:
Drab.Element.broadcast_html(Drab.Core.same_topic(brand_id), “#div”, values)

So after a browser refresh, both users are receiving the same broadcast above.

Is Drab maybe pushing the subscribe to all users on the ‘same_path’ when a browser is refreshed? since they are the same URL?
Is that what is meant to happen? How do i stop that happening?

Since my my users are subscribed to the topic based on their user data, I think the only way to have them subscribed is via the subscribe method in the callback.

Any other ideas or tips?

Hi @doogs,
I will try to reproduce the issue, but in the meantime, can you check that? This is the only explanation I can think of by now.

Hey, So I changed my routing and made each staff dashboard on a different URL.
so now “same_path” is different for both users. (e.g :brand_id/staff/)
This has now resolved the issue, and the broadcasts co to the correct subscribed topic in all conditions I tested.

So it seems you cannot dynamically subscribe to different topics on the same url/path. Drab seems to end up pushing information over the same_path instead of the subscribed broadcast topic in some circumstances.
This seemed to happen when I refreshed the browser of one user.

Not really sure if there is any way around this, or if you were able to reproduce the issue?
but for now I can get around it by making sure to have unique urls for certain channel topic requirements.

1 Like

In this case it looks like a bug, will try to reproduce the issue

In your case, what is in real the difference between opening the page, when everything works, and refreshing the page? Refresh is just re-open the same page, isn’t it?

I dont actually think there is much difference.

User 1 logs in (subscribe to Topic 1)
User 2 logs in (subscribe to Topic 2)
Event is pushed to topic 1: ok
Event is pushed to topic 2: ok
User 1 refreshes browser
Event is pushed to Topic 1: Both users get the same data

As soon as I refresh one of those browser windows it seems to start pushing messages to both users.

If i get time I will try setup a test project to see if i can get this to happen again. might help clear some of my code too.

1 Like

I finally managed to reproduce it - it looks like the it happens not only while refresh, and the order of opened browsers matters. Thanks a lot for finding it out!

1 Like

Hi @doogs,
could you please check the current master? I believe I’ve fixed the issue.


Yep! Seems to be working perfectly now!
Well done! you are a superstar!


Hi! @grych
Is it safe to upgrade to phoenix 1.4 and ecto 3.0 with drab?

Ecto is completely independent from Drab. I did not test Phx 1.4 yet, I will do it during incoming week.


I’ve been running Drab on Phx1.4 for a day now without any big issues noticed as of yet. :slight_smile:

1 Like

v0.10.0 is out

The main feature of this one is the Phx 1.4 compatibility, including the installer. Plus bugfixes.


Updated! Seems to work on cursory checks. :slight_smile:

1 Like