ryanb / private_pub

Handle pub/sub messaging through private channels in Rails using Faye.
MIT License
864 stars 228 forks source link

Allow multiple callbacks per subscription, upgrade to rspec 3.2, and jasmine 2.2 #112

Closed jeremywrowe closed 9 years ago

jeremywrowe commented 9 years ago

This provides a mechanism for multiple callbacks per channel subscription (client side).

Example on the client:

function updateUiElementA(data, channel) {
    ...
}

function updateUiElementB(data, channel) {
    ...
}

PrivatePub.subscribe('/something/important', updateUiElementA);
PrivatePub.subscribe('/something/important', updateUiElementB);

To me this is useful for scenarios as described above. Where an event happens and someone might want to update multiple UI elements with somewhat complex logic.

As an aside, I have also upgraded spec and jasmine gems. I wanted to keep the entire test suite green when making changes, in doing so I found that client side specs weren't running. I had to apply a manual pattern for spec files, and while I was at it I thought it might be a good time to bring the testing dependencies to a more current version.