سؤال

While experimenting with faye(private-pub in rails) i got a pretty basic doubt.Do we need to subscribe to a channel before publishing to that channel?

Please provide some resources for learning faye.

Thanks in advance :)

هل كانت مفيدة؟

المحلول

You can publish messages to any arbitrary channel with Private Pub regardless of whether or not you've subscribed to it. For instance, this example works just fine, without ever subscribing to anything:

PrivatePub.publish_to "some_random_channel", :data => "whatever"

Of course, the above code isn't useful at all - you can't receive that message without subscribing to that channel.

نصائح أخرى

http://railscasts.com/episodes/260-messaging-with-faye should you get starting or check out his references.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top