# Zotonic Cotonic models

Source: https://zotonic.com/cotonic/zotonic-models

URI: https://zotonic.com/id/2757

Language: en



Zotonic Cotonic models
======================

These browser-side models extend Cotonic with Zotonic functionality. Each model has its own reference page:

| Model                                                            | Purpose                                        |
| ---------------------------------------------------------------- | ---------------------------------------------- |
| [model/auth](/id/doc_zotonic_cotonic_model_auth)                 | Authentication state and operations.           |
| [model/auth-ui](/id/doc_zotonic_cotonic_model_auth_ui)           | Login and account recovery interfaces.         |
| [model/oauth](/id/doc_zotonic_cotonic_model_oauth)               | OAuth authorization and redirect flows.        |
| [model/fileuploader](/id/doc_zotonic_cotonic_model_fileuploader) | Chunked uploads and upload queues.             |
| [model/loadmore](/id/doc_zotonic_cotonic_model_loadmore)         | Replace a loader with server-rendered content. |
| [model/alert](/id/doc_zotonic_cotonic_model_alert)               | Alert dialogs.                                 |
| [model/clipboard](/id/doc_zotonic_cotonic_model_clipboard)       | Copy text to the clipboard.                    |
| [model/wires](/id/doc_zotonic_cotonic_model_wires)               | Trigger named Zotonic events.                  |
| [model/console](/id/doc_zotonic_cotonic_model_console)           | Browser console logging and ping replies.      |
| [model/activity](/id/doc_zotonic_cotonic_model_activity)         | Browser activity events; no request topics.    |

Calling conventions
-------------------

Use `cotonic.broker.publish(topic, payload)` for commands and `cotonic.broker.subscribe(topic, callback)` for events. The callback receives a message whose `payload` contains the data. Within a worker, use `self.publish` and `self.subscribe`.

Use `cotonic.broker.call` or `self.call` only where the operation documents a response. Many commands publish events or update the interface without replying to the request's response topic.

Client topics start with `model/`. A topic such as `bridge/origin/model/fileuploader/post/new` addresses a server-side Zotonic model; it is a different API from `model/fileuploader/post/new` in the browser.

Availability depends on the scripts and workers loaded by the page. Cotonic's own models, including <a href="/id/doc_cotonic_model_sessionid" class="doc-reference doc-reference-cotonic"><code>cotonic#sessionId</code></a>, <a href="/id/doc_cotonic_model_ui" class="doc-reference doc-reference-cotonic"><code>cotonic#ui</code></a>, and <a href="/id/doc_cotonic_model_location" class="doc-reference doc-reference-cotonic"><code>cotonic#location</code></a>, are documented in the Cotonic reference maintained in its repository.

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/2757?language=en


## API access

- [API help](<https://zotonic.com/api-help>)
- [OpenAPI specification](<https://zotonic.com/openapi.json>)
- [This resource as JSON](<https://zotonic.com/api/agent/resource/2757?language=en>)
