summaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2014-11-05 15:34:16 +0200
committerLoïc Hoguin <[email protected]>2014-11-05 15:34:16 +0200
commit46fbd90698130ea3d93d32118d19e3e480867194 (patch)
treed931e23c06d14f30dead76eaf699668b09c6fe40 /README.md
parentcd6daff28412a93b8b318586fefb5e0d9440ed3b (diff)
parent04a6efe11c1114056ae1317cb71a495ba4adf231 (diff)
downloadbullet-46fbd90698130ea3d93d32118d19e3e480867194.tar.gz
bullet-46fbd90698130ea3d93d32118d19e3e480867194.tar.bz2
bullet-46fbd90698130ea3d93d32118d19e3e480867194.zip
Merge branch 'patch-1' of git://github.com/marianoguerra/bullet
Diffstat (limited to 'README.md')
-rw-r--r--README.md17
1 files changed, 17 insertions, 0 deletions
diff --git a/README.md b/README.md
index e8ab736..e42aa15 100644
--- a/README.md
+++ b/README.md
@@ -35,6 +35,23 @@ The dispatch options for a Bullet handler looks as follow:
Simply define this in your dispatch list and your handler will be
available and handled by Bullet properly.
+The third element in the tuple ([{handler, my_stream}]) will be passed
+to init/4 as Opts, you can add your own options and get them using
+lists:keyfind, for example if we define our handler as:
+
+``` erlang
+{[<<"path">>, <<"to">>, <<"bullet">>], bullet_handler,
+ [{handler, my_stream}, {channel, "my channel"}]}
+```
+
+you can retrieve the channel value as follows:
+
+``` erlang
+init(_Transport, Req, Opts, _Active) ->
+ {channel, Channel} = lists:keyfind(channel, 1, Opts),
+ {ok, Req, #state{channel=Channel}}.
+```
+
Cowboy handler
--------------