ember-pusher
ember-pusher copied to clipboard
Variable pusherSubscriptions
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.
Yes please.
@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! :)
Current
PUSHER_SUBSCRIPTIONS: {
my-channel: ['pusher:subscription_succeeded']
}
Proposed
PUSHER_SUBSCRIPTIONS: [
{ channel: "my-channel", events: ['pusher:subscription_succeeded'] }
]
- Attach array observers to
PUSHER_SUBSCRIPTIONSto 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.
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.
@jamiebikies Ya, totally agree.
Any update on that? I also need variable channel names. How you guys managed to do that ?
We haven't implemented it yet, unfortunately. I haven't had the time lately to do it :sob: