README.rdoc in faye_shards-0.1.1 vs README.rdoc in faye_shards-0.1.2
- old
+ new
@@ -62,29 +62,29 @@
So, in my example for production I have 2 Faye instances listening to ports 42000 and 42001 using HTTP + Stunnel configured to listen 32000 and 32001.
== Usage
URL for Faye's client-side JS (unless you store it somewhere on diff storage) is returned by this methos:
- FayeShards.shard(current_user.id).js_url(request.ssl?)
+ current_user.faye_shard.js_url(request.ssl?)
Module <code>FayeShard::User::Faye</code> which can be included to your User model provides method <tt>faye_channel</tt> which returns unique channel id for user. If you do not want to include module to your model - you need to manage unique channels for users yourself.
On client side, subscription should look like:
- client = new Faye.Client(<%= raw FayeShards.shard(current_user.id).url(request.ssl?).inspect %>);
+ client = new Faye.Client(<%= raw current_user.faye_shard.url(request.ssl?).inspect %>);
fayeSubscription = client.subscribe(<%= raw current_user.faye_channel.inspect %>, function(data) {});
or
fayeSubscription = client.subscribe(<%= raw my_own_method_for_channel_id.inspect %>, function(data) {});
Pushing data to user's channel also depends on your decision to include module <code>FayeShard::User::Faye</code>. So, 2 options:
current_user.push_to_faye(data) # Sends data to channel, returned by current_user.faye_channel
or
- FayeShards.shard(1).push(my_own_method_for_channel_id, data)
+ FayeShards.shard(current_user.id).push(my_own_method_for_channel_id, data)
Extensions can be passed as an additional hash after <tt>data</tt>
-How to push to global channel and more information about gem can be found here: TODO.
+How to push to global channel and more information about gem can be found here: .
== Roadmap / TODO
* UT
* Add example Rails app which uses faye_shards.
* GOD scripts to start/monitor Faye instances based on faye.yml