Both sides previous revisionPrevious revisionNext revision | Previous revision |
dev:client_coding:connector_http_server [2019/06/19 19:44] – Update for Zotero 5.0. bwiernik | dev:client_coding:connector_http_server [2019/06/19 19:49] (current) – bwiernik |
---|
<html><p id="zotero-5-update-warning" style="color: red; font-weight: bold">We’re | ====== Zotero Connector HTTP Server ====== |
in the process of updating the documentation for | |
<a href="https://www.zotero.org/blog/zotero-5-0">Zotero 5.0</a>. Some documentation | |
may be outdated in the meantime. Thanks for your understanding.</p></html> | |
| |
Zotero has a built-in HTTP server to communicate with the [[/support/standalone#zotero_connectors|Zotero Connector]] browser extensions. | Zotero has a built-in HTTP server to communicate with the [[/support/standalone#zotero_connectors|Zotero Connector]] browser extensions. |
* ''/connector/ping'' | * ''/connector/ping'' |
| |
These endpoints are implemented in [[https://github.com/zotero/zotero/blob/master/chrome/content/zotero/xpcom/server_connector.js|server_connector.js]]. The server is implemented in [[https://github.com/zotero/zotero/blob/master/chrome/content/zotero/xpcom/server.js|server.js]]. | These endpoints are implemented in [[https://github.com/zotero/zotero/blob/master/chrome/content/zotero/xpcom/connector/server_connector.js|server_connector.js]]. The server is implemented in [[https://github.com/zotero/zotero/blob/master/chrome/content/zotero/xpcom/server.js|server.js]]. |
| |
====== Extending the Connector Server ====== | ====== Extending the Connector Server ====== |
The following code registers an additional endpoint with the connector server. | The following code registers an additional endpoint with the connector server. |
| |
This script must be run with chrome privileges. The best way to do this is to create an extension that [[https://developer.mozilla.org/en/XPCOM/Receiving_startup_notifications|registers an XPCOM service to run at Zotero startup]]. This can (and should if possible) be a [[https://developer.mozilla.org/en/Extensions/Bootstrapped_extensions|bootstrapped extension]]. Alternatively, you could register the endpoint from a overlay or from a chrome URI that you load manually. | This script must be run with chrome privileges. The best way to do this is to create an extension that [[https://web.archive.org/web/20190612191336/https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Guide/Receiving_startup_notifications|registers an XPCOM service to run at Zotero startup]]. This can (and should if possible) be a [[https://web.archive.org/web/20190613013728/https://developer.mozilla.org/en-US/docs/Archive/Add-ons/Bootstrapped_extensions|bootstrapped extension]]. Alternatively, you could register the endpoint from a overlay or from a chrome URI that you load manually. |
| |
Once registered, going to http://127.0.0.1:23119/myAddon/helloWorld in a web browser should produce a page containing "Hello world." | Once registered, going to http://127.0.0.1:23119/myAddon/helloWorld in a web browser should produce a page containing "Hello world." |