JS Callback Handler is a solution for creating highly performant server requests. This includes, but is not limited to, creating simple JSON callbacks.
This API is intended for module developers who wish to provide more of a "lean" approach to the Drupal bootstrapping process (not the front-end framework).
Note: this API does nothing by itself. It requires other modules to leverage its functionality and APIs.
Background and purpose
Drupal handles all requests - except those for public files - involving a standardized and complex bootstrap and database logic. Although that makes sense in most classic REST requests and is highly recommended for standard tasks due to caching and security reasons, it may cause a lot of performance cost on well frequented sites with much AJAX functionality.
JS (Callback Handler) does not really do anything itself but instead provides an API to other developers who want to improve their project's AJAX (, SOAP, AHAH, JSON etc) performance. This is mainly achieved with bypassing a lot of Drupal core functions which are not needed in every case, and by allowing to determine which core functionality will be loaded on a per-request base.
Think of a module which is only used for signaling that a user is still on your site. You might want to implement a JS interval who frequently tells the server "hi, this is session X with session cookie Y telling you that I'm still alive". You would not need any localization, forms API or theme engine involved to handle such a request properly, but think of the server load such a function would cause with some 100 users hailing every, say, 10 seconds using a complete Drupal request.
ab -n20 -c1 http://example.com/index.php?q=js/mymodule/callback Requests per second: 2.24 [#/sec] (mean) Time per request: 446.846 [ms] (mean)
ab -n20 -c1 http://example.com/js.php?q=js/mymodule/callback Requests per second: 16.84 [#/sec] (mean) Time per request: 59.371 [ms] (mean)
- Your server must support URL rewrites. E.g. in Apache, you need mod_rewrite enabled.
- Clean URLs need to be activated in your Drupal setup.
|Barracuda||✔︎||GH Issue #586|
|IP Geolocation Views & Maps||✔︎|
You can find an excellent post about the JS module (with an example) by another Drupal enthusiast here:
- Maintenance status: Actively maintained
- Development status: Under active development
- Reported installs: 1,736 sites currently report using this module. View usage statistics.
- Downloads: 143,203
- Last modified: December 25, 2016
- Stable releases are covered by the security advisory policy.
Look for the shield icon below.