By default the JavaScript is passed to eval, but some like to manage it through JSON. There should be an alternative syntax for supplying a callback function to a given subscription. Here's what the documentation could look like:
Alternatively you can pass anything you want to the publish_to method (it will be converted to_json).
By default the JavaScript is passed to
eval
, but some like to manage it through JSON. There should be an alternative syntax for supplying a callback function to a given subscription. Here's what the documentation could look like:Alternatively you can pass anything you want to the
publish_to
method (it will be convertedto_json
).And then handle that in a callback in JavaScript.
Note: the
subscribe_to
call is still necessary with this approach to grant the user access to that channel. The JavaScript is just a callback.