ember-pusher icon indicating copy to clipboard operation
ember-pusher copied to clipboard

Variable pusherSubscriptions

Open gilgen opened this issue 12 years ago • 7 comments

Right now, PUSHER_SUBSCRIPTIONS is a constant and any modifications to it at runtime (other than during controller's init()) will be ignored.

Make EmberPusher.Bindings watch pusherSubscriptions and subscribe/unsubscribe as the user adds and removes channels/events to the hash.

gilgen avatar Oct 02 '13 13:10 gilgen

Yes please.

edborden avatar Apr 12 '14 15:04 edborden

@edborden I don't have time right now, but if you want to take a stab at it and submit a PR that's cool! :)

gilgen avatar Apr 12 '14 15:04 gilgen

Current

PUSHER_SUBSCRIPTIONS: {
  my-channel: ['pusher:subscription_succeeded']
}

Proposed

PUSHER_SUBSCRIPTIONS: [
  { channel: "my-channel", events: ['pusher:subscription_succeeded'] }
]
  • Attach array observers to PUSHER_SUBSCRIPTIONS to wire/unwire as we add/remove subscriptions from this array.
  • Attach observers to the "channel" key on each subscription to wire/unwire whenever the channel changes.
  • Every time an event is received on a channel/subscription we filter it by checking if it is in the events array before sending it to the target.

mmun avatar May 01 '14 19:05 mmun

I would propose that if the property is bound, we use the name pusherSubscriptions. I chose PUSHER_SUBSCRIPTIONS originally to hopefully make it clear that it's not bound.

gilgen avatar May 01 '14 21:05 gilgen

@jamiebikies Ya, totally agree.

mmun avatar May 01 '14 21:05 mmun

Any update on that? I also need variable channel names. How you guys managed to do that ?

vasilakisfil avatar Apr 18 '15 11:04 vasilakisfil

We haven't implemented it yet, unfortunately. I haven't had the time lately to do it :sob:

gilgen avatar May 13 '15 05:05 gilgen