Skip to content

Commit 4dc8144

Browse files
committed
Improve the docs for declared channels js handlers
1 parent dbff039 commit 4dc8144

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

docs/src/create_chans.rst

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,30 @@ the channels.
4848

4949
Each channel can have its own handler: just create it in the handlers directory: example: if a ``$mychan`` is declared in
5050
settings it is possible to create a ``$mychan.js`` file in the handlers directory to manage the handling logics
51-
just for that channel
51+
just for that channel.
5252

53+
Example handler:
54+
55+
.. highlight:: javascript
56+
57+
::
58+
59+
if (event_class === "someclass") {
60+
console.log(message)
61+
}
62+
63+
Available variables:
64+
65+
``event_class`` : class of the event
66+
67+
``channel`` : name of the channel
68+
69+
``message`` : text message
70+
71+
``data`` : json payload
72+
73+
``site`` : site slug
74+
75+
``uid`` : unique id of the message
76+
77+
``timestamp`` : date timestamp

0 commit comments

Comments
 (0)